Skip to content

Commit

Permalink
CodeGen from PR 27095 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 757a0fde47d91344f1cd82344b67a240f5c722f5 into a14b79a1aa6837156181e37705613737fabad223
  • Loading branch information
SDKAuto committed Dec 15, 2023
1 parent caf2f97 commit 7d802a3
Show file tree
Hide file tree
Showing 1,044 changed files with 419,884 additions and 14,612 deletions.
30 changes: 24 additions & 6 deletions sdk/appplatform/azure-mgmt-appplatform/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
{
"commit": "fce14bf881523f16b14d8ecf325e004465cdcf56",
"commit": "7db79c1894fe680e4196c2d66c96c242cdfd1edc",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.3",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/appplatform/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/appplatform/resource-manager/readme.md"
"autorest_command": "autorest specification/appplatform/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/appplatform/resource-manager/readme.md",
"package-preview-2024-01": "2023-12-13 17:26:15 +0800 a14b79a1aa6837156181e37705613737fabad223 Microsoft.AppPlatform/preview/2024-01-01-preview/appplatform.json",
"package-preview-2023-11": "2023-10-25 09:34:29 +0800 eac41e7f43d1fdfeff98eced43a90d7b1dd746e2 Microsoft.AppPlatform/preview/2023-11-01-preview/appplatform.json",
"package-preview-2023-09": "2023-09-13 03:01:23 +0800 2fff12c0f30c9be23b280152f20f8fb0db7afb98 Microsoft.AppPlatform/preview/2023-09-01-preview/appplatform.json",
"package-preview-2023-07": "2023-08-24 15:09:29 +0800 0b6eab579426b030aa84996b9c1b35ce137a7f9f Microsoft.AppPlatform/preview/2023-07-01-preview/appplatform.json",
"package-preview-2023-05": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-05-01-preview/appplatform.json",
"package-preview-2023-03": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-03-01-preview/appplatform.json",
"package-preview-2023-01": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2023-01-01-preview/appplatform.json",
"package-2022-12": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2022-12-01/appplatform.json",
"package-preview-2022-11": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-11-01-preview/appplatform.json",
"package-preview-2022-09": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-09-01-preview/appplatform.json",
"package-preview-2022-05": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-05-01-preview/appplatform.json",
"package-2022-04": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2022-04-01/appplatform.json",
"package-preview-2022-03": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-03-01-preview/appplatform.json",
"package-preview-2022-01": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2022-01-01-preview/appplatform.json",
"package-preview-2021-09": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-09-01-preview/appplatform.json",
"package-preview-2021-06": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-06-01-preview/appplatform.json",
"package-preview-2020-11": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2020-11-01-preview/appplatform.json",
"package-2020-07": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2020-07-01/appplatform.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get('skip_quote', False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get('do_quote', False):
serialized = [
'' if s is None else quote(str(s), safe='')
for s
in serialized
]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down Expand Up @@ -1273,7 +1287,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1297,7 +1311,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
Loading

0 comments on commit 7d802a3

Please sign in to comment.