Skip to content

Commit 989ed6f

Browse files
api-clients-generation-pipeline[bot]therveci.datadog-api-spec
authored
Reorganize python params_map (#710)
* Reorganize params_map It seems to gratuitously differentiate from the openapi-generator structure, which leads to a lot of duplication. Let's try to reduce it. * Fix docstrings * Typo * Use singular * Regenerate client from commit 42876d3 of spec repo Co-authored-by: Thomas Hervé <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b6383a4 commit 989ed6f

File tree

1,054 files changed

+7144
-13650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,054 files changed

+7144
-13650
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.5.1.dev2",
7-
"regenerated": "2021-12-07 15:59:00.380490",
8-
"spec_repo_commit": "c0fb344"
7+
"regenerated": "2021-12-08 13:12:43.323885",
8+
"spec_repo_commit": "42876d3"
99
},
1010
"v2": {
1111
"apigentools_version": "1.5.1.dev2",
12-
"regenerated": "2021-12-07 15:59:00.863160",
13-
"spec_repo_commit": "c0fb344"
12+
"regenerated": "2021-12-08 13:12:43.813509",
13+
"spec_repo_commit": "42876d3"
1414
}
1515
}
1616
}

.generator/templates/api.mustache

Lines changed: 16 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import sys # noqa: F401
55

66
from {{packageName}}.api_client import ApiClient, Endpoint as _Endpoint
77
from {{packageName}}.model_utils import ( # noqa: F401
8-
check_allowed_values,
9-
check_validations,
108
date,
119
datetime,
1210
file_type,
@@ -88,50 +86,19 @@ class {{classname}}(object):
8886
{{/servers}}
8987
},
9088
params_map={
91-
'all': [
92-
{{#allParams}}
93-
'{{paramName}}',
94-
{{/allParams}}
95-
],
96-
{{#requiredParams}}
97-
{{#-first}}
98-
'required': [
99-
{{/-first}}
100-
'{{paramName}}',
101-
{{#-last}}
102-
],
103-
{{/-last}}
104-
{{/requiredParams}}
105-
{{^requiredParams}}
106-
'required': [],
107-
{{/requiredParams}}
108-
'nullable': [
109-
{{#allParams}}
110-
{{#isNullable}}
111-
'{{paramName}}',
112-
{{/isNullable}}
113-
{{/allParams}}
114-
],
115-
'enum': [
11689
{{#allParams}}
90+
'{{paramName}}': {
91+
{{#required}}'required': True,{{/required}}
92+
{{#isNullable}}'nullable': True,{{/isNullable}}
11793
{{#isEnum}}
118-
'{{paramName}}',
94+
'allowed_values': {
95+
{{#isNullable}}
96+
'None': None,{{/isNullable}}{{#allowableValues}}{{#enumVars}}
97+
"{{name}}": {{{value}}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
98+
},
11999
{{/isEnum}}
120-
{{/allParams}}
121-
],
122-
'validation': [
123-
{{#allParams}}
124100
{{#hasValidation}}
125-
'{{paramName}}',
126-
{{/hasValidation}}
127-
{{/allParams}}
128-
]
129-
},
130-
root_map={
131-
'validations': {
132-
{{#allParams}}
133-
{{#hasValidation}}
134-
('{{paramName}}',): {
101+
'validation': {
135102
{{#maxLength}}
136103
'max_length': {{.}},{{/maxLength}}{{#minLength}}
137104
'min_length': {{.}},{{/minLength}}{{#maxItems}}
@@ -145,45 +112,17 @@ class {{classname}}(object):
145112
},{{/pattern}}
146113
},
147114
{{/hasValidation}}
148-
{{/allParams}}
149-
},
150-
'allowed_values': {
151-
{{#allParams}}
152-
{{#isEnum}}
153-
('{{paramName}}',): {
154-
{{#isNullable}}
155-
'None': None,{{/isNullable}}{{#allowableValues}}{{#enumVars}}
156-
"{{name}}": {{{value}}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
157-
},
158-
{{/isEnum}}
159-
{{/allParams}}
160-
},
161-
'openapi_types': {
162-
{{#allParams}}
163-
'{{paramName}}':
164-
({{{dataType}}},),
165-
{{/allParams}}
166-
},
167-
'attribute_map': {
168-
{{#allParams}}
169-
{{^isBodyParam}}
170-
'{{paramName}}': '{{baseName}}',
115+
'openapi_types': ({{{dataType}}},),
116+
{{^isBodyParam}}
117+
'attribute': '{{baseName}}',
171118
{{/isBodyParam}}
172-
{{/allParams}}
173-
},
174-
'location_map': {
175-
{{#allParams}}
176-
'{{paramName}}': '{{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isCookieParam}}cookie{{/isCookieParam}}{{#isBodyParam}}body{{/isBodyParam}}',
177-
{{/allParams}}
178-
},
179-
'collection_format_map': {
180-
{{#allParams}}
119+
'location': '{{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isCookieParam}}cookie{{/isCookieParam}}{{#isBodyParam}}body{{/isBodyParam}}',
181120
{{#collectionFormat}}
182-
'{{paramName}}': '{{collectionFormat}}',
121+
'collection_format': '{{collectionFormat}}',
183122
{{/collectionFormat}}
123+
},
184124
{{/allParams}}
185-
}
186-
},
125+
},
187126
headers_map={
188127
{{#hasProduces}}
189128
'accept': [

0 commit comments

Comments
 (0)