@autorest/python 6.42.2 → 6.43.0

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.
@@ -254,7 +254,7 @@ class FileImport:
254
254
  msrest_import_type: MsrestImportType,
255
255
  typing_section: TypingSection,
256
256
  ):
257
- if self.code_model.options["client-side-validation"]:
257
+ if not self.code_model.need_utils_serialization:
258
258
  if msrest_import_type == MsrestImportType.Module:
259
259
  self.add_import("msrest.serialization", ImportType.SDKCORE, typing_section)
260
260
  else:
@@ -63,6 +63,7 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
63
63
  self.next_link_reinjected_parameters: list[Parameter] = [
64
64
  Parameter.from_yaml(p, code_model) for p in yaml_data.get("nextLinkReInjectedParameters", [])
65
65
  ]
66
+ self.next_link_verb: str = (yaml_data.get("nextLinkVerb") or "GET").upper()
66
67
 
67
68
  @property
68
69
  def has_continuation_token(self) -> bool:
@@ -1331,7 +1331,7 @@ class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]):
1331
1331
  except StopIteration:
1332
1332
  pass
1333
1333
 
1334
- retval.append(f'_request = HttpRequest("GET", {next_link_str}{query_str})')
1334
+ retval.append(f'_request = HttpRequest("{builder.next_link_verb}", {next_link_str}{query_str})')
1335
1335
  retval.extend(self._postprocess_http_request(builder, "_request.url"))
1336
1336
 
1337
1337
  return retval
@@ -178,7 +178,7 @@ class ClientSerializer:
178
178
  client_models_str = "client_models" if is_msrest_model else ""
179
179
  retval.append(f"self._serialize = Serializer({client_models_str})")
180
180
  retval.append(f"self._deserialize = Deserializer({client_models_str})")
181
- if not self.client.code_model.options["client-side-validation"]:
181
+ if self.client.code_model.need_utils_serialization:
182
182
  retval.append("self._serialize.client_side_validation = False")
183
183
  operation_groups = [og for og in self.client.operation_groups if not og.is_mixin]
184
184
  for og in operation_groups:
@@ -173,9 +173,7 @@ class MsrestModelSerializer(_ModelSerializer):
173
173
 
174
174
  def declare_model(self, model: ModelType) -> str:
175
175
  basename = (
176
- "msrest.serialization.Model"
177
- if self.code_model.options["client-side-validation"]
178
- else "_serialization.Model"
176
+ "msrest.serialization.Model" if not self.code_model.need_utils_serialization else "_serialization.Model"
179
177
  )
180
178
  if model.parents:
181
179
  basename = ", ".join([m.name for m in model.parents])
@@ -62,7 +62,7 @@ Example:
62
62
  {% macro declare_serializer(code_model) %}
63
63
  {% if code_model.has_non_abstract_operations %}
64
64
  _SERIALIZER = Serializer()
65
- {% if not code_model.options["client-side-validation"] %}
65
+ {% if code_model.need_utils_serialization %}
66
66
  _SERIALIZER.client_side_validation = False
67
67
  {% endif %}
68
68
  {% endif %}
@@ -38,7 +38,7 @@ keywords = ["azure", "azure sdk"]
38
38
  {% endif %}
39
39
 
40
40
  dependencies = [
41
- {% if code_model.is_legacy %}
41
+ {% if code_model.is_legacy and not code_model.need_utils_serialization %}
42
42
  "msrest>={{ VERSION_MAP['msrest'] }}",
43
43
  {% else %}
44
44
  "isodate>={{ VERSION_MAP['isodate'] }}",
@@ -95,7 +95,7 @@ setup(
95
95
  include_package_data=True,
96
96
  {% endif %}
97
97
  install_requires=[
98
- {% if code_model.is_legacy %}
98
+ {% if code_model.is_legacy and not code_model.need_utils_serialization %}
99
99
  "msrest>={{ VERSION_MAP["msrest"] }}",
100
100
  {% else %}
101
101
  "isodate>={{ VERSION_MAP["isodate"] }}",
@@ -254,7 +254,7 @@ class FileImport:
254
254
  msrest_import_type: MsrestImportType,
255
255
  typing_section: TypingSection,
256
256
  ):
257
- if self.code_model.options["client-side-validation"]:
257
+ if not self.code_model.need_utils_serialization:
258
258
  if msrest_import_type == MsrestImportType.Module:
259
259
  self.add_import("msrest.serialization", ImportType.SDKCORE, typing_section)
260
260
  else:
@@ -63,6 +63,7 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
63
63
  self.next_link_reinjected_parameters: list[Parameter] = [
64
64
  Parameter.from_yaml(p, code_model) for p in yaml_data.get("nextLinkReInjectedParameters", [])
65
65
  ]
66
+ self.next_link_verb: str = (yaml_data.get("nextLinkVerb") or "GET").upper()
66
67
 
67
68
  @property
68
69
  def has_continuation_token(self) -> bool:
@@ -1331,7 +1331,7 @@ class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]):
1331
1331
  except StopIteration:
1332
1332
  pass
1333
1333
 
1334
- retval.append(f'_request = HttpRequest("GET", {next_link_str}{query_str})')
1334
+ retval.append(f'_request = HttpRequest("{builder.next_link_verb}", {next_link_str}{query_str})')
1335
1335
  retval.extend(self._postprocess_http_request(builder, "_request.url"))
1336
1336
 
1337
1337
  return retval
@@ -178,7 +178,7 @@ class ClientSerializer:
178
178
  client_models_str = "client_models" if is_msrest_model else ""
179
179
  retval.append(f"self._serialize = Serializer({client_models_str})")
180
180
  retval.append(f"self._deserialize = Deserializer({client_models_str})")
181
- if not self.client.code_model.options["client-side-validation"]:
181
+ if self.client.code_model.need_utils_serialization:
182
182
  retval.append("self._serialize.client_side_validation = False")
183
183
  operation_groups = [og for og in self.client.operation_groups if not og.is_mixin]
184
184
  for og in operation_groups:
@@ -173,9 +173,7 @@ class MsrestModelSerializer(_ModelSerializer):
173
173
 
174
174
  def declare_model(self, model: ModelType) -> str:
175
175
  basename = (
176
- "msrest.serialization.Model"
177
- if self.code_model.options["client-side-validation"]
178
- else "_serialization.Model"
176
+ "msrest.serialization.Model" if not self.code_model.need_utils_serialization else "_serialization.Model"
179
177
  )
180
178
  if model.parents:
181
179
  basename = ", ".join([m.name for m in model.parents])
@@ -62,7 +62,7 @@ Example:
62
62
  {% macro declare_serializer(code_model) %}
63
63
  {% if code_model.has_non_abstract_operations %}
64
64
  _SERIALIZER = Serializer()
65
- {% if not code_model.options["client-side-validation"] %}
65
+ {% if code_model.need_utils_serialization %}
66
66
  _SERIALIZER.client_side_validation = False
67
67
  {% endif %}
68
68
  {% endif %}
@@ -38,7 +38,7 @@ keywords = ["azure", "azure sdk"]
38
38
  {% endif %}
39
39
 
40
40
  dependencies = [
41
- {% if code_model.is_legacy %}
41
+ {% if code_model.is_legacy and not code_model.need_utils_serialization %}
42
42
  "msrest>={{ VERSION_MAP['msrest'] }}",
43
43
  {% else %}
44
44
  "isodate>={{ VERSION_MAP['isodate'] }}",
@@ -95,7 +95,7 @@ setup(
95
95
  include_package_data=True,
96
96
  {% endif %}
97
97
  install_requires=[
98
- {% if code_model.is_legacy %}
98
+ {% if code_model.is_legacy and not code_model.need_utils_serialization %}
99
99
  "msrest>={{ VERSION_MAP["msrest"] }}",
100
100
  {% else %}
101
101
  "isodate>={{ VERSION_MAP["isodate"] }}",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.42.2",
3
+ "version": "6.43.0",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
21
21
  "dependencies": {
22
- "@typespec/http-client-python": "~0.20.3",
22
+ "@typespec/http-client-python": "~0.21.0",
23
23
  "@autorest/system-requirements": "~1.0.2",
24
24
  "fs-extra": "~11.2.0",
25
25
  "tsx": "~4.19.1"