Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Modelerfour version: 4.15.378
Autorest Core version: 3.0.6287
Modelerfour version: 4.15.378

**New Features**

- Add support for `x-ms-text` XML extension #722

**Bug Fixes**

- Correctly have default behavior of csv for array query parameters when collection format is not specified in the swagger
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ AutoRest needs the below config to pick this up as a plug-in - see https://githu
pass-thru:
- model-deduplicator
- subset-reducer
version: 3.0.6287
version: 3.0.6302
use-extension:
"@autorest/modelerfour": "4.15.378"

Expand Down
2 changes: 2 additions & 0 deletions autorest/codegen/models/base_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def xml_serialization_ctxt(self) -> Optional[str]:
attrs_list.append(f"'prefix': '{self.xml_metadata['prefix']}'")
if self.xml_metadata.get("namespace", False):
attrs_list.append(f"'ns': '{self.xml_metadata['namespace']}'")
if self.xml_metadata.get("extensions", {}).get("x-ms-text", False):
attrs_list.append(f"'text': True")
return ", ".join(attrs_list)

def imports(self) -> FileImport: # pylint: disable=no-self-use
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@autorest/autorest": "^3.0.0",
"@microsoft.azure/autorest.testserver": "^2.10.53"
"@microsoft.azure/autorest.testserver": "^2.10.54"
},
"files": [
"autorest/**/*.py",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def put_positive_duration(
) -> None:
"""Put a positive duration value.

:param duration_body:
:param duration_body: duration body.
:type duration_body: ~datetime.timedelta
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def put_positive_duration(
# type: (...) -> None
"""Put a positive duration value.

:param duration_body:
:param duration_body: duration body.
:type duration_body: ~datetime.timedelta
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
6 changes: 6 additions & 0 deletions test/vanilla/AcceptanceTests/asynctests/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,9 @@ async def test_acls(self, client):
assert len(acls) == 1
assert acls[0].id == 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI='
await _assert_with_log(client.xml.put_acls, acls)

@pytest.mark.asyncio
async def test_xms_text(self, client):
xml_object = await client.xml.get_xms_text()
assert xml_object.language == "english"
assert xml_object.content == "I am text"
5 changes: 5 additions & 0 deletions test/vanilla/AcceptanceTests/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,8 @@ def test_models(self):
else:
from xmlservice.models._models import Error as ErrorPy2
assert Error == ErrorPy2

def test_xms_text(self, client):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #725 is merged, will add async xms-text test as well

xml_object = client.xml.get_xms_text()
assert xml_object.language == "english"
assert xml_object.content == "I am text"
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async def put_max_date(
) -> None:
"""Put max date value 9999-12-31.

:param date_body:
:param date_body: date body.
:type date_body: ~datetime.date
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -312,7 +312,7 @@ async def put_min_date(
) -> None:
"""Put min date value 0000-01-01.

:param date_body:
:param date_body: date body.
:type date_body: ~datetime.date
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def put_max_date(
# type: (...) -> None
"""Put max date value 9999-12-31.

:param date_body:
:param date_body: date body.
:type date_body: ~datetime.date
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -323,7 +323,7 @@ def put_min_date(
# type: (...) -> None
"""Put min date value 0000-01-01.

:param date_body:
:param date_body: date body.
:type date_body: ~datetime.date
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async def put_utc_max_date_time(
) -> None:
"""Put max datetime value 9999-12-31T23:59:59.999Z.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -272,7 +272,7 @@ async def put_utc_max_date_time7_digits(
This is against the recommendation that asks for 3 digits, but allow to test what happens in
that scenario.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -452,7 +452,7 @@ async def put_local_positive_offset_max_date_time(
) -> None:
"""Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -586,7 +586,7 @@ async def put_local_negative_offset_max_date_time(
) -> None:
"""Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -720,7 +720,7 @@ async def put_utc_min_date_time(
) -> None:
"""Put min datetime value 0001-01-01T00:00:00Z.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -811,7 +811,7 @@ async def put_local_positive_offset_min_date_time(
) -> None:
"""Put min datetime value 0001-01-01T00:00:00+14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -902,7 +902,7 @@ async def put_local_negative_offset_min_date_time(
) -> None:
"""Put min datetime value 0001-01-01T00:00:00-14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def put_utc_max_date_time(
# type: (...) -> None
"""Put max datetime value 9999-12-31T23:59:59.999Z.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -282,7 +282,7 @@ def put_utc_max_date_time7_digits(
This is against the recommendation that asks for 3 digits, but allow to test what happens in
that scenario.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -466,7 +466,7 @@ def put_local_positive_offset_max_date_time(
# type: (...) -> None
"""Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -603,7 +603,7 @@ def put_local_negative_offset_max_date_time(
# type: (...) -> None
"""Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -740,7 +740,7 @@ def put_utc_min_date_time(
# type: (...) -> None
"""Put min datetime value 0001-01-01T00:00:00Z.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -833,7 +833,7 @@ def put_local_positive_offset_min_date_time(
# type: (...) -> None
"""Put min datetime value 0001-01-01T00:00:00+14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -926,7 +926,7 @@ def put_local_negative_offset_min_date_time(
# type: (...) -> None
"""Put min datetime value 0001-01-01T00:00:00-14:00.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async def put_utc_max_date_time(
) -> None:
"""Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -355,7 +355,7 @@ async def put_utc_min_date_time(
) -> None:
"""Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def put_utc_max_date_time(
# type: (...) -> None
"""Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -367,7 +367,7 @@ def put_utc_min_date_time(
# type: (...) -> None
"""Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT.

:param datetime_body:
:param datetime_body: datetime body.
:type datetime_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def put_positive_duration(
) -> None:
"""Put a positive duration value.

:param duration_body:
:param duration_body: duration body.
:type duration_body: ~datetime.timedelta
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def put_positive_duration(
# type: (...) -> None
"""Put a positive duration value.

:param duration_body:
:param duration_body: duration body.
:type duration_body: ~datetime.timedelta
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ async def put_max32(
) -> None:
"""Put max int32 value.

:param int_body:
:param int_body: int body.
:type int_body: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -355,7 +355,7 @@ async def put_max64(
) -> None:
"""Put max int64 value.

:param int_body:
:param int_body: int body.
:type int_body: long
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -403,7 +403,7 @@ async def put_min32(
) -> None:
"""Put min int32 value.

:param int_body:
:param int_body: int body.
:type int_body: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -451,7 +451,7 @@ async def put_min64(
) -> None:
"""Put min int64 value.

:param int_body:
:param int_body: int body.
:type int_body: long
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -542,7 +542,7 @@ async def put_unix_time_date(
) -> None:
"""Put datetime encoded as Unix time.

:param int_body:
:param int_body: int body.
:type int_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def put_max32(
# type: (...) -> None
"""Put max int32 value.

:param int_body:
:param int_body: int body.
:type int_body: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -367,7 +367,7 @@ def put_max64(
# type: (...) -> None
"""Put max int64 value.

:param int_body:
:param int_body: int body.
:type int_body: long
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -416,7 +416,7 @@ def put_min32(
# type: (...) -> None
"""Put min int32 value.

:param int_body:
:param int_body: int body.
:type int_body: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -465,7 +465,7 @@ def put_min64(
# type: (...) -> None
"""Put min int64 value.

:param int_body:
:param int_body: int body.
:type int_body: long
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down Expand Up @@ -558,7 +558,7 @@ def put_unix_time_date(
# type: (...) -> None
"""Put datetime encoded as Unix time.

:param int_body:
:param int_body: int body.
:type int_body: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def validation_of_method_parameters(
url = self.validation_of_method_parameters.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9']+'),
'id': self._serialize.url("id", id, 'int', maximum=1000, minimum=100, multiple=10),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def validation_of_method_parameters(
url = self.validation_of_method_parameters.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9']+'),
'id': self._serialize.url("id", id, 'int', maximum=1000, minimum=100, multiple=10),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down
Loading