@@ -35,3 +35,58 @@ and run the following command
35
35
` ` ` bash
36
36
graphql2python render --config ./graphql2python.yaml
37
37
```
38
+
39
+ ## Config reference
40
+
41
+ Global keywords
42
+
43
+ | keyword | description |
44
+ | ----------------| ---------------------------------------------------------------|
45
+ | ` schema ` | A path to the target GraphQL schema file. |
46
+ | ` output ` | A file name for output ` py ` file. |
47
+ | ` license_file ` | An optional path to a file with license for output ` py ` file. |
48
+ | ` options ` | Optional options for render of output ` py ` file. |
49
+
50
+ Options keywords
51
+
52
+ | keywords | description |
53
+ | -----------------------| ------------------------------------------------------------------------------------------------------------------------|
54
+ | ` max_line_len ` | The maximum of line length of output ` py ` file. Default is ` 120 ` . |
55
+ | ` name_suffix ` | A suffix for invalid field name (as python object name). Default is ` "_" ` . |
56
+ | ` each_field_optional ` | Each fields of interfaces and objects are optional. Default is ` false ` . |
57
+ | ` add_from_dict ` | Add ` from_dict ` (dict -> model) method to the general class. Default is ` false ` . |
58
+ | ` add_to_dict ` | Add ` to_dict ` (model -> dict) method to the general class. Default is ` false ` . |
59
+ | ` scalar_pytypes ` | A dict with python types for custom GraphQL scalars. Maps from scalar name to python type name. Default is empty dict. |
60
+ | ` fields_setting ` | Settings for interfaces or objects fields. Maps from object name to a dict with setting. Default is empty dict. |
61
+
62
+ ` fields_setting ` keywords for some object name
63
+
64
+ | keywords | desciption |
65
+ | ------------| -----------------------------------------------------------------------|
66
+ | ` alias ` | An alias for a field (see Field.alias for pydantic). Default is null. |
67
+ | ` new_name ` | A new name for a field. Default is null. |
68
+
69
+ An example for ` graphql2python.yaml ` config:
70
+
71
+ ``` yaml
72
+ # graphql2python.yaml
73
+ schema : ./schema/schema.graphql
74
+ output : ./model/model.py
75
+ license_file : ./LICENSE
76
+ options :
77
+ scalar_pytypes :
78
+ String : str
79
+ Float : float
80
+ Int : int
81
+ ID : str
82
+ Boolean : bool
83
+ DateTime : datetime
84
+ Date : date
85
+ max_line_len : 79
86
+ each_field_optional : true
87
+ fields_setting :
88
+ MyObjectName :
89
+ from :
90
+ alias : from
91
+ new_name : correct_from
92
+ ` ` `
0 commit comments