@autorest/python 6.13.12 → 6.13.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autorest/_utils.py +5 -3
- package/autorest/codegen/__init__.py +5 -3
- package/autorest/codegen/models/base_builder.py +3 -6
- package/autorest/codegen/models/enum_type.py +5 -3
- package/autorest/codegen/models/lro_operation.py +2 -2
- package/autorest/codegen/models/model_type.py +13 -9
- package/autorest/codegen/models/paging_operation.py +2 -2
- package/autorest/codegen/models/parameter.py +1 -2
- package/autorest/codegen/models/primitive_types.py +20 -12
- package/autorest/codegen/models/request_builder.py +9 -8
- package/autorest/codegen/serializers/__init__.py +1 -1
- package/autorest/codegen/serializers/builder_serializer.py +51 -38
- package/autorest/codegen/serializers/client_serializer.py +3 -3
- package/autorest/codegen/serializers/metadata_serializer.py +5 -5
- package/autorest/codegen/serializers/model_serializer.py +2 -4
- package/autorest/codegen/templates/model_base.py.jinja2 +1 -2
- package/autorest/m4reformatter/__init__.py +5 -3
- package/autorest/preprocess/__init__.py +6 -6
- package/package.json +1 -1
- package/requirements.txt +1 -1
package/autorest/_utils.py
CHANGED
|
@@ -136,9 +136,11 @@ def build_policies(
|
|
|
136
136
|
"self._config.user_agent_policy",
|
|
137
137
|
"self._config.proxy_policy",
|
|
138
138
|
"policies.ContentDecodePolicy(**kwargs)",
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
(
|
|
140
|
+
f"{async_prefix}ARMAutoResourceProviderRegistrationPolicy()"
|
|
141
|
+
if is_arm
|
|
142
|
+
else None
|
|
143
|
+
),
|
|
142
144
|
"self._config.redirect_policy",
|
|
143
145
|
"self._config.retry_policy",
|
|
144
146
|
"self._config.authentication_policy",
|
|
@@ -62,9 +62,11 @@ class OptionsRetriever:
|
|
|
62
62
|
def license_header(self) -> str:
|
|
63
63
|
license_header = self.options.get(
|
|
64
64
|
"header-text",
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
(
|
|
66
|
+
DEFAULT_HEADER_TEXT.format(company_name=self.company_name)
|
|
67
|
+
if self.company_name
|
|
68
|
+
else ""
|
|
69
|
+
),
|
|
68
70
|
)
|
|
69
71
|
if license_header:
|
|
70
72
|
license_header = license_header.replace("\n", "\n# ")
|
|
@@ -100,16 +100,13 @@ class BaseBuilder(
|
|
|
100
100
|
return ""
|
|
101
101
|
|
|
102
102
|
@abstractmethod
|
|
103
|
-
def response_type_annotation(self, **kwargs) -> str:
|
|
104
|
-
...
|
|
103
|
+
def response_type_annotation(self, **kwargs) -> str: ...
|
|
105
104
|
|
|
106
105
|
@abstractmethod
|
|
107
|
-
def response_docstring_text(self, **kwargs) -> str:
|
|
108
|
-
...
|
|
106
|
+
def response_docstring_text(self, **kwargs) -> str: ...
|
|
109
107
|
|
|
110
108
|
@abstractmethod
|
|
111
|
-
def response_docstring_type(self, **kwargs) -> str:
|
|
112
|
-
...
|
|
109
|
+
def response_docstring_type(self, **kwargs) -> str: ...
|
|
113
110
|
|
|
114
111
|
@property
|
|
115
112
|
def description(self) -> str:
|
|
@@ -256,8 +256,10 @@ class EnumType(BaseType):
|
|
|
256
256
|
"models",
|
|
257
257
|
ImportType.LOCAL,
|
|
258
258
|
alias="_models",
|
|
259
|
-
typing_section=
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
typing_section=(
|
|
260
|
+
TypingSection.TYPING
|
|
261
|
+
if kwargs.get("model_typing")
|
|
262
|
+
else TypingSection.REGULAR
|
|
263
|
+
),
|
|
262
264
|
)
|
|
263
265
|
return file_import
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# pylint: disable=multiple-statements
|
|
1
2
|
# -------------------------------------------------------------------------
|
|
2
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
4
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
@@ -151,5 +152,4 @@ class LROOperationBase(OperationBase[LROResponseType]):
|
|
|
151
152
|
return file_import
|
|
152
153
|
|
|
153
154
|
|
|
154
|
-
class LROOperation(LROOperationBase[LROResponse]):
|
|
155
|
-
...
|
|
155
|
+
class LROOperation(LROOperationBase[LROResponse]): ...
|
|
@@ -165,9 +165,9 @@ class ModelType( # pylint: disable=abstract-method
|
|
|
165
165
|
]
|
|
166
166
|
}
|
|
167
167
|
if self.discriminator and self.discriminator_value:
|
|
168
|
-
representation[
|
|
169
|
-
f'"{self.
|
|
170
|
-
|
|
168
|
+
representation[f'"{self.discriminator.wire_name}"'] = (
|
|
169
|
+
f'"{self.discriminator_value}"'
|
|
170
|
+
)
|
|
171
171
|
|
|
172
172
|
# once we've finished, we want to reset created_json_template_representation to false
|
|
173
173
|
# so we can call it again
|
|
@@ -333,18 +333,22 @@ class GeneratedModelType(ModelType): # pylint: disable=abstract-method
|
|
|
333
333
|
"models",
|
|
334
334
|
ImportType.LOCAL,
|
|
335
335
|
alias="_models",
|
|
336
|
-
typing_section=
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
typing_section=(
|
|
337
|
+
TypingSection.TYPING
|
|
338
|
+
if kwargs.get("model_typing")
|
|
339
|
+
else TypingSection.REGULAR
|
|
340
|
+
),
|
|
339
341
|
)
|
|
340
342
|
if self.is_form_data:
|
|
341
343
|
file_import.add_submodule_import(
|
|
342
344
|
relative_path,
|
|
343
345
|
"_model_base",
|
|
344
346
|
ImportType.LOCAL,
|
|
345
|
-
typing_section=
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
typing_section=(
|
|
348
|
+
TypingSection.TYPING
|
|
349
|
+
if kwargs.get("model_typing")
|
|
350
|
+
else TypingSection.REGULAR
|
|
351
|
+
),
|
|
348
352
|
)
|
|
349
353
|
return file_import
|
|
350
354
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# pylint: disable=multiple-statements
|
|
1
2
|
# -------------------------------------------------------------------------
|
|
2
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
4
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
@@ -182,5 +183,4 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
182
183
|
return file_import
|
|
183
184
|
|
|
184
185
|
|
|
185
|
-
class PagingOperation(PagingOperationBase[PagingResponse]):
|
|
186
|
-
...
|
|
186
|
+
class PagingOperation(PagingOperationBase[PagingResponse]): ...
|
|
@@ -227,8 +227,7 @@ class _ParameterBase(
|
|
|
227
227
|
|
|
228
228
|
@property
|
|
229
229
|
@abc.abstractmethod
|
|
230
|
-
def in_method_signature(self) -> bool:
|
|
231
|
-
...
|
|
230
|
+
def in_method_signature(self) -> bool: ...
|
|
232
231
|
|
|
233
232
|
def method_signature(self, async_mode: bool) -> str:
|
|
234
233
|
type_annot = self.type_annotation(async_mode=async_mode)
|
|
@@ -228,18 +228,26 @@ class NumberType(PrimitiveType): # pylint: disable=abstract-method
|
|
|
228
228
|
@property
|
|
229
229
|
def serialization_constraints(self) -> List[str]:
|
|
230
230
|
validation_constraints = [
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
231
|
+
(
|
|
232
|
+
f"maximum_ex={self.maximum}"
|
|
233
|
+
if self.maximum is not None and self.exclusive_maximum
|
|
234
|
+
else None
|
|
235
|
+
),
|
|
236
|
+
(
|
|
237
|
+
f"maximum={self.maximum}"
|
|
238
|
+
if self.maximum is not None and not self.exclusive_maximum
|
|
239
|
+
else None
|
|
240
|
+
),
|
|
241
|
+
(
|
|
242
|
+
f"minimum_ex={self.minimum}"
|
|
243
|
+
if self.minimum is not None and self.exclusive_minimum
|
|
244
|
+
else None
|
|
245
|
+
),
|
|
246
|
+
(
|
|
247
|
+
f"minimum={self.minimum}"
|
|
248
|
+
if self.minimum is not None and not self.exclusive_minimum
|
|
249
|
+
else None
|
|
250
|
+
),
|
|
243
251
|
f"multiple={self.multiple}" if self.multiple else None,
|
|
244
252
|
]
|
|
245
253
|
return [x for x in validation_constraints if x is not None]
|
|
@@ -117,12 +117,14 @@ class RequestBuilderBase(BaseBuilder[ParameterListType, List["RequestBuilder"]])
|
|
|
117
117
|
"typing", "Any", ImportType.STDLIB, typing_section=TypingSection.CONDITIONAL
|
|
118
118
|
)
|
|
119
119
|
file_import.add_msrest_import(
|
|
120
|
-
relative_path=
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
relative_path=(
|
|
121
|
+
"..."
|
|
122
|
+
if (
|
|
123
|
+
not self.code_model.options["builders_visibility"] == "embedded"
|
|
124
|
+
and self.group_name
|
|
125
|
+
)
|
|
126
|
+
else ".."
|
|
127
|
+
),
|
|
126
128
|
msrest_import_type=MsrestImportType.Serializer,
|
|
127
129
|
typing_section=TypingSection.REGULAR,
|
|
128
130
|
)
|
|
@@ -137,8 +139,7 @@ class RequestBuilderBase(BaseBuilder[ParameterListType, List["RequestBuilder"]])
|
|
|
137
139
|
@abstractmethod
|
|
138
140
|
def parameter_list_type() -> (
|
|
139
141
|
Callable[[Dict[str, Any], "CodeModel"], ParameterListType]
|
|
140
|
-
):
|
|
141
|
-
...
|
|
142
|
+
): ...
|
|
142
143
|
|
|
143
144
|
@classmethod
|
|
144
145
|
def get_name(
|
|
@@ -524,7 +524,7 @@ class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method
|
|
|
524
524
|
)
|
|
525
525
|
if self.code_model.options.get("emit_cross_language_definition_file"):
|
|
526
526
|
self.write_file(
|
|
527
|
-
|
|
527
|
+
Path("./apiview_mapping_python.json"),
|
|
528
528
|
general_serializer.serialize_cross_language_definition_file(),
|
|
529
529
|
)
|
|
530
530
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# pylint: disable=too-many-lines
|
|
1
|
+
# pylint: disable=too-many-lines,multiple-statements
|
|
2
2
|
# -------------------------------------------------------------------------
|
|
3
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
@@ -59,6 +59,10 @@ OperationType = TypeVar(
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
def _json_serializable(content_type: str) -> bool:
|
|
63
|
+
return bool(JSON_REGEXP.match(content_type.split(";")[0].strip().lower()))
|
|
64
|
+
|
|
65
|
+
|
|
62
66
|
def _need_type_ignore(builder: OperationType) -> bool:
|
|
63
67
|
for excep in builder.non_default_errors:
|
|
64
68
|
for status_code in excep.status_codes:
|
|
@@ -262,8 +266,7 @@ class _BuilderBaseSerializer(Generic[BuilderType]): # pylint: disable=abstract-
|
|
|
262
266
|
|
|
263
267
|
@property
|
|
264
268
|
@abstractmethod
|
|
265
|
-
def _need_self_param(self) -> bool:
|
|
266
|
-
...
|
|
269
|
+
def _need_self_param(self) -> bool: ...
|
|
267
270
|
|
|
268
271
|
@property
|
|
269
272
|
@abstractmethod
|
|
@@ -378,8 +381,7 @@ class _BuilderBaseSerializer(Generic[BuilderType]): # pylint: disable=abstract-
|
|
|
378
381
|
|
|
379
382
|
@property
|
|
380
383
|
@abstractmethod
|
|
381
|
-
def _json_response_template_name(self) -> str:
|
|
382
|
-
...
|
|
384
|
+
def _json_response_template_name(self) -> str: ...
|
|
383
385
|
|
|
384
386
|
def _json_input_example_template(self, builder: BuilderType) -> List[str]:
|
|
385
387
|
template: List[str] = []
|
|
@@ -525,12 +527,16 @@ class RequestBuilderSerializer(
|
|
|
525
527
|
return self.parameter_serializer.pop_kwargs_from_signature(
|
|
526
528
|
builder.parameters.kwargs_to_pop,
|
|
527
529
|
check_kwarg_dict=True,
|
|
528
|
-
pop_headers_kwarg=
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
530
|
+
pop_headers_kwarg=(
|
|
531
|
+
PopKwargType.CASE_INSENSITIVE
|
|
532
|
+
if bool(builder.parameters.headers)
|
|
533
|
+
else PopKwargType.NO
|
|
534
|
+
),
|
|
535
|
+
pop_params_kwarg=(
|
|
536
|
+
PopKwargType.CASE_INSENSITIVE
|
|
537
|
+
if bool(builder.parameters.query)
|
|
538
|
+
else PopKwargType.NO
|
|
539
|
+
),
|
|
534
540
|
)
|
|
535
541
|
|
|
536
542
|
@staticmethod
|
|
@@ -711,16 +717,20 @@ class _OperationSerializer(
|
|
|
711
717
|
kwargs = self.parameter_serializer.pop_kwargs_from_signature(
|
|
712
718
|
kwargs_to_pop,
|
|
713
719
|
check_kwarg_dict=True,
|
|
714
|
-
pop_headers_kwarg=
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
pop_headers_kwarg=(
|
|
721
|
+
PopKwargType.CASE_INSENSITIVE
|
|
722
|
+
if builder.has_kwargs_to_pop_with_default(
|
|
723
|
+
kwargs_to_pop, ParameterLocation.HEADER # type: ignore
|
|
724
|
+
)
|
|
725
|
+
else PopKwargType.SIMPLE
|
|
726
|
+
),
|
|
727
|
+
pop_params_kwarg=(
|
|
728
|
+
PopKwargType.CASE_INSENSITIVE
|
|
729
|
+
if builder.has_kwargs_to_pop_with_default(
|
|
730
|
+
kwargs_to_pop, ParameterLocation.QUERY # type: ignore
|
|
731
|
+
)
|
|
732
|
+
else PopKwargType.SIMPLE
|
|
733
|
+
),
|
|
724
734
|
check_client_input=not self.code_model.options["multiapi"],
|
|
725
735
|
operation_name=f"('{builder.name}')" if builder.group_name == "" else "",
|
|
726
736
|
)
|
|
@@ -807,7 +817,7 @@ class _OperationSerializer(
|
|
|
807
817
|
f"'{body_param.type.serialization_type}'{is_xml_cmd}{serialization_ctxt_cmd})"
|
|
808
818
|
)
|
|
809
819
|
elif self.code_model.options["models_mode"] == "dpg":
|
|
810
|
-
if
|
|
820
|
+
if _json_serializable(body_param.default_content_type):
|
|
811
821
|
if hasattr(body_param.type, "encode") and body_param.type.encode: # type: ignore
|
|
812
822
|
create_body_call = (
|
|
813
823
|
f"_{body_kwarg_name} = json.dumps({body_param.client_name}, "
|
|
@@ -1151,7 +1161,7 @@ class _OperationSerializer(
|
|
|
1151
1161
|
)
|
|
1152
1162
|
response_attr = (
|
|
1153
1163
|
"json"
|
|
1154
|
-
if
|
|
1164
|
+
if _json_serializable(str(response.default_content_type))
|
|
1155
1165
|
else "text"
|
|
1156
1166
|
)
|
|
1157
1167
|
deserialize_code.append("deserialized = _deserialize(")
|
|
@@ -1217,9 +1227,11 @@ class _OperationSerializer(
|
|
|
1217
1227
|
retval.append(
|
|
1218
1228
|
" raise HttpResponseError(response=response{}{})".format(
|
|
1219
1229
|
error_model,
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1230
|
+
(
|
|
1231
|
+
", error_format=ARMErrorFormat"
|
|
1232
|
+
if self.code_model.options["azure_arm"]
|
|
1233
|
+
else ""
|
|
1234
|
+
),
|
|
1223
1235
|
)
|
|
1224
1236
|
)
|
|
1225
1237
|
return retval
|
|
@@ -1364,8 +1376,7 @@ class _OperationSerializer(
|
|
|
1364
1376
|
return "await " if self.async_mode else ""
|
|
1365
1377
|
|
|
1366
1378
|
|
|
1367
|
-
class OperationSerializer(_OperationSerializer[Operation]):
|
|
1368
|
-
...
|
|
1379
|
+
class OperationSerializer(_OperationSerializer[Operation]): ...
|
|
1369
1380
|
|
|
1370
1381
|
|
|
1371
1382
|
############################## PAGING OPERATIONS ##############################
|
|
@@ -1552,8 +1563,7 @@ class _PagingOperationSerializer(
|
|
|
1552
1563
|
return retval
|
|
1553
1564
|
|
|
1554
1565
|
|
|
1555
|
-
class PagingOperationSerializer(_PagingOperationSerializer[PagingOperation]):
|
|
1556
|
-
...
|
|
1566
|
+
class PagingOperationSerializer(_PagingOperationSerializer[PagingOperation]): ...
|
|
1557
1567
|
|
|
1558
1568
|
|
|
1559
1569
|
############################## LRO OPERATIONS ##############################
|
|
@@ -1682,12 +1692,16 @@ class _LROOperationSerializer(_OperationSerializer[LROOperationType]):
|
|
|
1682
1692
|
retval.append(" if cls:")
|
|
1683
1693
|
retval.append(
|
|
1684
1694
|
" return cls(pipeline_response, {}, {}){}".format(
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1695
|
+
(
|
|
1696
|
+
"deserialized"
|
|
1697
|
+
if builder.lro_response and builder.lro_response.type
|
|
1698
|
+
else "None"
|
|
1699
|
+
),
|
|
1700
|
+
(
|
|
1701
|
+
"response_headers"
|
|
1702
|
+
if builder.lro_response and builder.lro_response.headers
|
|
1703
|
+
else "{}"
|
|
1704
|
+
),
|
|
1691
1705
|
" # type: ignore",
|
|
1692
1706
|
)
|
|
1693
1707
|
)
|
|
@@ -1696,8 +1710,7 @@ class _LROOperationSerializer(_OperationSerializer[LROOperationType]):
|
|
|
1696
1710
|
return retval
|
|
1697
1711
|
|
|
1698
1712
|
|
|
1699
|
-
class LROOperationSerializer(_LROOperationSerializer[LROOperation]):
|
|
1700
|
-
...
|
|
1713
|
+
class LROOperationSerializer(_LROOperationSerializer[LROOperation]): ...
|
|
1701
1714
|
|
|
1702
1715
|
|
|
1703
1716
|
############################## LRO PAGING OPERATIONS ##############################
|
|
@@ -206,9 +206,9 @@ class ClientSerializer:
|
|
|
206
206
|
send_request_signature = self._send_request_signature()
|
|
207
207
|
return utils.method_signature_and_response_type_annotation_template(
|
|
208
208
|
method_signature=send_request_signature,
|
|
209
|
-
response_type_annotation=
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
response_type_annotation=(
|
|
210
|
+
"Awaitable[AsyncHttpResponse]" if async_mode else "HttpResponse"
|
|
211
|
+
),
|
|
212
212
|
)
|
|
213
213
|
|
|
214
214
|
def _example_make_call(self, async_mode: bool) -> List[str]:
|
|
@@ -66,11 +66,11 @@ def _json_serialize_imports(
|
|
|
66
66
|
if name_imports:
|
|
67
67
|
name_import_ordered_list = list(name_imports)
|
|
68
68
|
name_import_ordered_list.sort(
|
|
69
|
-
key=lambda e:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
key=lambda e: (
|
|
70
|
+
_to_string(e) # type: ignore
|
|
71
|
+
if isinstance(e, (list, tuple))
|
|
72
|
+
else e if isinstance(e, str) else ""
|
|
73
|
+
)
|
|
74
74
|
)
|
|
75
75
|
json_package_name_dictionary[package_name] = name_import_ordered_list
|
|
76
76
|
json_import_type_dictionary[import_type_key] = json_package_name_dictionary
|
|
@@ -30,8 +30,7 @@ def _documentation_string(
|
|
|
30
30
|
|
|
31
31
|
class _ModelSerializer(BaseSerializer, ABC):
|
|
32
32
|
@abstractmethod
|
|
33
|
-
def imports(self) -> FileImport:
|
|
34
|
-
...
|
|
33
|
+
def imports(self) -> FileImport: ...
|
|
35
34
|
|
|
36
35
|
def serialize(self) -> str:
|
|
37
36
|
# Generate the models
|
|
@@ -44,8 +43,7 @@ class _ModelSerializer(BaseSerializer, ABC):
|
|
|
44
43
|
)
|
|
45
44
|
|
|
46
45
|
@abstractmethod
|
|
47
|
-
def declare_model(self, model: ModelType) -> str:
|
|
48
|
-
...
|
|
46
|
+
def declare_model(self, model: ModelType) -> str: ...
|
|
49
47
|
|
|
50
48
|
@staticmethod
|
|
51
49
|
def escape_dot(s: str):
|
|
@@ -13,7 +13,6 @@ import sys
|
|
|
13
13
|
import logging
|
|
14
14
|
import base64
|
|
15
15
|
import re
|
|
16
|
-
import copy
|
|
17
16
|
import typing
|
|
18
17
|
import enum
|
|
19
18
|
import email.utils
|
|
@@ -347,7 +346,7 @@ _UNSET = object()
|
|
|
347
346
|
|
|
348
347
|
class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object
|
|
349
348
|
def __init__(self, data: typing.Dict[str, typing.Any]) -> None:
|
|
350
|
-
self._data =
|
|
349
|
+
self._data = data
|
|
351
350
|
|
|
352
351
|
def __contains__(self, key: typing.Any) -> bool:
|
|
353
352
|
return key in self._data
|
|
@@ -1143,9 +1143,11 @@ class M4Reformatter(
|
|
|
1143
1143
|
"name": yaml_data["language"]["default"]["name"],
|
|
1144
1144
|
"description": yaml_data["info"].get("description"),
|
|
1145
1145
|
"parameters": parameters,
|
|
1146
|
-
"url":
|
|
1147
|
-
|
|
1148
|
-
|
|
1146
|
+
"url": (
|
|
1147
|
+
update_client_url(yaml_data)
|
|
1148
|
+
if yaml_data.get("globalParameters")
|
|
1149
|
+
else ""
|
|
1150
|
+
),
|
|
1149
1151
|
}
|
|
1150
1152
|
|
|
1151
1153
|
def update_yaml(self, yaml_data: Dict[str, Any]) -> None:
|
|
@@ -69,9 +69,9 @@ def add_overload(
|
|
|
69
69
|
content_type_param["inOverload"] = True
|
|
70
70
|
content_type_param["inDocstring"] = True
|
|
71
71
|
body_type_description = get_body_type_for_description(overload["bodyParameter"])
|
|
72
|
-
content_type_param[
|
|
73
|
-
"
|
|
74
|
-
|
|
72
|
+
content_type_param["description"] = (
|
|
73
|
+
f"Body Parameter content-type. Content type parameter for {body_type_description} body."
|
|
74
|
+
)
|
|
75
75
|
content_types = yaml_data["bodyParameter"]["contentTypes"]
|
|
76
76
|
if body_type["type"] == "binary" and len(content_types) > 1:
|
|
77
77
|
content_types = "'" + "', '".join(content_types) + "'"
|
|
@@ -110,9 +110,9 @@ def add_overloads_for_body_param(yaml_data: Dict[str, Any]) -> None:
|
|
|
110
110
|
content_type_param["inOverload"] = False
|
|
111
111
|
content_type_param["inOverriden"] = True
|
|
112
112
|
content_type_param["inDocstring"] = True
|
|
113
|
-
content_type_param[
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
content_type_param["clientDefaultValue"] = (
|
|
114
|
+
None # make it none bc it will be overriden, we depend on default of overloads
|
|
115
|
+
)
|
|
116
116
|
content_type_param["optional"] = True
|
|
117
117
|
|
|
118
118
|
|
package/package.json
CHANGED
package/requirements.txt
CHANGED