Skip to content

Commit

Permalink
add client side validation info to mixin operations (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Sep 14, 2020
1 parent 494403c commit 70fad5b
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 18 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

### 2020-09-14 - 5.3.2
Autorest core version: 3.0.6318

Modelerfour version: 4.15.419

**Bug fixes**

- Allow client side validation to be turned off for multiapi mixin operations #775

### 2020-09-14 - 5.3.1
Autorest core version: 3.0.6318

Expand Down
3 changes: 2 additions & 1 deletion autorest/codegen/templates/metadata.json.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"base_url": {{ (keywords.escape_str(base_url) if base_url else None) | tojson }},
"custom_base_url": {{ (keywords.escape_str(code_model.custom_base_url) if code_model.custom_base_url else None) | tojson }},
"azure_arm": {{ code_model.options["azure_arm"] | tojson }},
"has_lro_operations": {{ code_model.has_lro_operations | tojson }}
"has_lro_operations": {{ code_model.has_lro_operations | tojson }},
"client_side_validation": {{ code_model.options["client_side_validation"] | tojson }}
},
"global_parameters": {
"sync_method": {
Expand Down
1 change: 1 addition & 0 deletions autorest/multiapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def process(self) -> bool:
"base_url": metadata_json["client"]["base_url"],
"custom_base_url_to_api_version": self._build_custom_base_url_to_api_version(paths_to_versions),
"azure_arm": metadata_json["client"]["azure_arm"],
"client_side_validation": metadata_json["client"]["client_side_validation"],
"has_lro_operations": self._has_lro_operations(paths_to_versions)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class {{ client_name }}OperationsMixin(object):
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
{% if not client_side_validation %}
mixin_instance._serialize.client_side_validation = False
{% endif %}
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return {{ "await " if async_mode and metadata['coroutine'] else "" }}mixin_instance.{{ operation_name }}({{ metadata['call'] }}{{ ", **kwargs" if metadata['call'] else "**kwargs" }})
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -89,6 +90,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -120,6 +122,7 @@ def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -143,5 +146,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -85,6 +86,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -116,6 +118,7 @@ async def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -139,5 +142,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -89,6 +90,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -120,6 +122,7 @@ def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -143,5 +146,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -85,6 +86,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -116,6 +118,7 @@ async def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -139,5 +142,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ def test(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test(id, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ async def test(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.test(id, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": null,
"custom_base_url": "\u0027{Endpoint}/multiapiCustomBaseUrl/v1\u0027",
"azure_arm": false,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": null,
"custom_base_url": "\u0027{Endpoint}/multiapiCustomBaseUrl/v2\u0027",
"azure_arm": false,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -88,6 +89,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -119,6 +121,7 @@ def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -142,5 +145,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -84,6 +85,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -115,6 +117,7 @@ async def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -138,5 +141,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": false,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": false,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": false,
"has_lro_operations": false
"has_lro_operations": false,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def begin_test_lro(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro(product, **kwargs)

Expand Down Expand Up @@ -89,6 +90,7 @@ def begin_test_lro_and_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs)

Expand Down Expand Up @@ -120,6 +122,7 @@ def test_one(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_one(id, message, **kwargs)

Expand All @@ -143,5 +146,6 @@ def test_paging(
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.test_paging(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"base_url": "\u0027http://localhost:3000\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
Expand Down
Loading

0 comments on commit 70fad5b

Please sign in to comment.