From fe7381d69515ce78008abd05c60db1f944f1f89d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 7 Jun 2021 11:40:15 -0400 Subject: [PATCH 1/7] if constant is optional, don't force to value --- autorest/codegen/models/object_schema.py | 1 - autorest/codegen/models/property.py | 30 ++++++++++++------- .../Constants/constants/models/_models.py | 26 ++++------------ .../Constants/constants/models/_models_py3.py | 30 +++++-------------- .../modelflattening/models/_models.py | 20 ++++--------- .../modelflattening/models/_models_py3.py | 22 +++++--------- .../Validation/validation/models/_models.py | 7 ++--- .../validation/models/_models_py3.py | 8 ++--- 8 files changed, 55 insertions(+), 89 deletions(-) diff --git a/autorest/codegen/models/object_schema.py b/autorest/codegen/models/object_schema.py index 200e8c13963..996c759e7b8 100644 --- a/autorest/codegen/models/object_schema.py +++ b/autorest/codegen/models/object_schema.py @@ -129,7 +129,6 @@ def fill_instance_from_yaml(self, namespace: str, yaml_data: Dict[str, Any], **k # map of discriminator value to child's name for children_yaml in yaml_data["discriminator"]["immediate"].values(): subtype_map[children_yaml["discriminatorValue"]] = children_yaml["language"]["python"]["name"] - if yaml_data.get("properties"): properties += [ Property.from_yaml(p, has_additional_properties=len(properties) > 0, **kwargs) diff --git a/autorest/codegen/models/property.py b/autorest/codegen/models/property.py index 426435cab46..43c616fad78 100644 --- a/autorest/codegen/models/property.py +++ b/autorest/codegen/models/property.py @@ -32,26 +32,36 @@ def __init__( self.required: bool = yaml_data.get("required", False) self.readonly: bool = yaml_data.get("readOnly", False) self.is_discriminator: bool = yaml_data.get("isDiscriminator", False) - # this bool doesn't consider you to be constant if you are a discriminator - self.constant: bool = isinstance(self.schema, ConstantSchema) and not self.is_discriminator - if description: self.description = description else: self.description = yaml_data["language"]["python"]["description"] - validation_map: Dict[str, Union[bool, int, str]] = {} + self.client_default_value = client_default_value + + @property + def constant(self) -> bool: + # this bool doesn't consider you to be constant if you are a discriminator + # you also have to be required to be considered a constant + return ( + isinstance(self.schema, ConstantSchema) and + self.required and + not self.is_discriminator + ) + + @property + def validation_map(self) -> Optional[Dict[str, Union[bool, int, str]]]: + retval: Dict[str, Union[bool, int, str]] = {} if self.required: - validation_map["required"] = True + retval["required"] = True if self.readonly: - validation_map["readonly"] = True + retval["readonly"] = True if self.constant: - validation_map["constant"] = True + retval["constant"] = True if self.schema.validation_map: validation_map_from_schema = cast(Dict[str, Union[bool, int, str]], self.schema.validation_map) - validation_map.update(validation_map_from_schema) - self.validation_map = validation_map or None - self.client_default_value = client_default_value + retval.update(validation_map_from_schema) + return retval or None @property def escaped_swagger_name(self) -> str: diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py index 49053a757a8..a7569b538be 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py @@ -164,47 +164,33 @@ def __init__(self, **kwargs): class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar parameter: Default value: "value1". - :vartype parameter: str + :param parameter: + :type parameter: str """ - _validation = { - "parameter": {"constant": True}, - } - _attribute_map = { "parameter": {"key": "parameter", "type": "str"}, } - parameter = "value1" - def __init__(self, **kwargs): super(NoModelAsStringNoRequiredOneValueDefault, self).__init__(**kwargs) + self.parameter = kwargs.get("parameter", "value1") class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar parameter: Default value: "value1". - :vartype parameter: str + :param parameter: + :type parameter: str """ - _validation = { - "parameter": {"constant": True}, - } - _attribute_map = { "parameter": {"key": "parameter", "type": "str"}, } - parameter = "value1" - def __init__(self, **kwargs): super(NoModelAsStringNoRequiredOneValueNoDefault, self).__init__(**kwargs) + self.parameter = kwargs.get("parameter", None) class NoModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py index 9faaff8c9db..7e87b53dd80 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py @@ -176,47 +176,33 @@ def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredTwoValueNoDefa class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar parameter: Default value: "value1". - :vartype parameter: str + :param parameter: + :type parameter: str """ - _validation = { - "parameter": {"constant": True}, - } - _attribute_map = { "parameter": {"key": "parameter", "type": "str"}, } - parameter = "value1" - - def __init__(self, **kwargs): + def __init__(self, *, parameter: Optional[str] = "value1", **kwargs): super(NoModelAsStringNoRequiredOneValueDefault, self).__init__(**kwargs) + self.parameter = parameter class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar parameter: Default value: "value1". - :vartype parameter: str + :param parameter: + :type parameter: str """ - _validation = { - "parameter": {"constant": True}, - } - _attribute_map = { "parameter": {"key": "parameter", "type": "str"}, } - parameter = "value1" - - def __init__(self, **kwargs): + def __init__(self, *, parameter: Optional[str] = None, **kwargs): super(NoModelAsStringNoRequiredOneValueNoDefault, self).__init__(**kwargs) + self.parameter = parameter class NoModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py index b485c619526..d01e4c43364 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py @@ -159,8 +159,6 @@ def __init__(self, **kwargs): class FlattenParameterGroup(msrest.serialization.Model): """Parameter group. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param name: Required. Product name with value 'groupproduct'. @@ -175,8 +173,8 @@ class FlattenParameterGroup(msrest.serialization.Model): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :ivar capacity: Capacity of product. For example, 4 people. Default value: "Large". - :vartype capacity: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -186,7 +184,6 @@ class FlattenParameterGroup(msrest.serialization.Model): _validation = { "name": {"required": True}, "product_id": {"required": True}, - "capacity": {"constant": True}, } _attribute_map = { @@ -200,8 +197,6 @@ class FlattenParameterGroup(msrest.serialization.Model): "odata_value": {"key": "@odata\\.value", "type": "str"}, } - capacity = "Large" - def __init__(self, **kwargs): super(FlattenParameterGroup, self).__init__(**kwargs) self.name = kwargs["name"] @@ -209,6 +204,7 @@ def __init__(self, **kwargs): self.product_id = kwargs["product_id"] self.description = kwargs.get("description", None) self.max_product_display_name = kwargs.get("max_product_display_name", None) + self.capacity = kwargs.get("capacity", None) self.generic_value = kwargs.get("generic_value", None) self.odata_value = kwargs.get("odata_value", None) @@ -291,8 +287,6 @@ def __init__(self, **kwargs): class SimpleProduct(BaseProduct): """The product documentation. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param product_id: Required. Unique identifier representing a specific product for a given @@ -303,8 +297,8 @@ class SimpleProduct(BaseProduct): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :ivar capacity: Capacity of product. For example, 4 people. Default value: "Large". - :vartype capacity: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -313,7 +307,6 @@ class SimpleProduct(BaseProduct): _validation = { "product_id": {"required": True}, - "capacity": {"constant": True}, } _attribute_map = { @@ -325,11 +318,10 @@ class SimpleProduct(BaseProduct): "odata_value": {"key": "details.max_product_image.@odata\\.value", "type": "str"}, } - capacity = "Large" - def __init__(self, **kwargs): super(SimpleProduct, self).__init__(**kwargs) self.max_product_display_name = kwargs.get("max_product_display_name", None) + self.capacity = kwargs.get("capacity", None) self.generic_value = kwargs.get("generic_value", None) self.odata_value = kwargs.get("odata_value", None) diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py index 369cf4238f6..cdc49822cdc 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py @@ -177,8 +177,6 @@ def __init__( class FlattenParameterGroup(msrest.serialization.Model): """Parameter group. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param name: Required. Product name with value 'groupproduct'. @@ -193,8 +191,8 @@ class FlattenParameterGroup(msrest.serialization.Model): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :ivar capacity: Capacity of product. For example, 4 people. Default value: "Large". - :vartype capacity: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -204,7 +202,6 @@ class FlattenParameterGroup(msrest.serialization.Model): _validation = { "name": {"required": True}, "product_id": {"required": True}, - "capacity": {"constant": True}, } _attribute_map = { @@ -218,8 +215,6 @@ class FlattenParameterGroup(msrest.serialization.Model): "odata_value": {"key": "@odata\\.value", "type": "str"}, } - capacity = "Large" - def __init__( self, *, @@ -228,6 +223,7 @@ def __init__( simple_body_product: Optional["SimpleProduct"] = None, description: Optional[str] = None, max_product_display_name: Optional[str] = None, + capacity: Optional[str] = None, generic_value: Optional[str] = None, odata_value: Optional[str] = None, **kwargs @@ -238,6 +234,7 @@ def __init__( self.product_id = product_id self.description = description self.max_product_display_name = max_product_display_name + self.capacity = capacity self.generic_value = generic_value self.odata_value = odata_value @@ -327,8 +324,6 @@ def __init__( class SimpleProduct(BaseProduct): """The product documentation. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param product_id: Required. Unique identifier representing a specific product for a given @@ -339,8 +334,8 @@ class SimpleProduct(BaseProduct): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :ivar capacity: Capacity of product. For example, 4 people. Default value: "Large". - :vartype capacity: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -349,7 +344,6 @@ class SimpleProduct(BaseProduct): _validation = { "product_id": {"required": True}, - "capacity": {"constant": True}, } _attribute_map = { @@ -361,20 +355,20 @@ class SimpleProduct(BaseProduct): "odata_value": {"key": "details.max_product_image.@odata\\.value", "type": "str"}, } - capacity = "Large" - def __init__( self, *, product_id: str, description: Optional[str] = None, max_product_display_name: Optional[str] = None, + capacity: Optional[str] = None, generic_value: Optional[str] = None, odata_value: Optional[str] = None, **kwargs ): super(SimpleProduct, self).__init__(product_id=product_id, description=description, **kwargs) self.max_product_display_name = max_product_display_name + self.capacity = capacity self.generic_value = generic_value self.odata_value = odata_value diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py index 650d73eba0f..89db56f7ac2 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py @@ -114,8 +114,8 @@ class Product(msrest.serialization.Model): :vartype const_int: int :ivar const_string: Required. Constant string. Default value: "constant". :vartype const_string: str - :ivar const_string_as_enum: Constant string as Enum. Default value: "constant_string_as_enum". - :vartype const_string_as_enum: str + :param const_string_as_enum: Constant string as Enum. + :type const_string_as_enum: str """ _validation = { @@ -126,7 +126,6 @@ class Product(msrest.serialization.Model): "const_child": {"required": True}, "const_int": {"required": True, "constant": True}, "const_string": {"required": True, "constant": True}, - "const_string_as_enum": {"constant": True}, } _attribute_map = { @@ -142,7 +141,6 @@ class Product(msrest.serialization.Model): const_int = 0 const_string = "constant" - const_string_as_enum = "constant_string_as_enum" def __init__(self, **kwargs): super(Product, self).__init__(**kwargs) @@ -151,3 +149,4 @@ def __init__(self, **kwargs): self.image = kwargs.get("image", None) self.child = kwargs["child"] self.const_child = kwargs["const_child"] + self.const_string_as_enum = kwargs.get("const_string_as_enum", None) diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py index e8ed1d89950..647b9123edb 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py @@ -118,8 +118,8 @@ class Product(msrest.serialization.Model): :vartype const_int: int :ivar const_string: Required. Constant string. Default value: "constant". :vartype const_string: str - :ivar const_string_as_enum: Constant string as Enum. Default value: "constant_string_as_enum". - :vartype const_string_as_enum: str + :param const_string_as_enum: Constant string as Enum. + :type const_string_as_enum: str """ _validation = { @@ -130,7 +130,6 @@ class Product(msrest.serialization.Model): "const_child": {"required": True}, "const_int": {"required": True, "constant": True}, "const_string": {"required": True, "constant": True}, - "const_string_as_enum": {"constant": True}, } _attribute_map = { @@ -146,7 +145,6 @@ class Product(msrest.serialization.Model): const_int = 0 const_string = "constant" - const_string_as_enum = "constant_string_as_enum" def __init__( self, @@ -156,6 +154,7 @@ def __init__( display_names: Optional[List[str]] = None, capacity: Optional[int] = None, image: Optional[str] = None, + const_string_as_enum: Optional[str] = None, **kwargs ): super(Product, self).__init__(**kwargs) @@ -164,3 +163,4 @@ def __init__( self.image = image self.child = child self.const_child = const_child + self.const_string_as_enum = const_string_as_enum From 47ba07443f7cf29fda0c9f9227f93f68b7df789d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 7 Jun 2021 11:43:57 -0400 Subject: [PATCH 2/7] update changelog --- ChangeLog.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 7ac23fb8a42..41fd08bad54 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,16 @@ # Change Log +### 2021-06-07 - 5.8.1 + +min Autorest core version: 3.3.0 + +min Modelerfour version: 4.19.1 + +**Bug Fixes** + +- Fix optional properties with constant schemas. Now, properties that have constant schemas but are optional will not have the hardcoded constant value, +but will default to its `x-ms-client-default` or `None` #952 + ### 2021-05-17 - 5.8.0 min Autorest core version: 3.3.0 From bf29f732d88a0fb286bf3b95a8e2b9864584038a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 7 Jun 2021 13:31:55 -0400 Subject: [PATCH 3/7] fix inclusion of constant in signature --- autorest/codegen/models/parameter.py | 2 +- .../AcceptanceTests/asynctests/test_model_flattening.py | 5 +++++ test/vanilla/AcceptanceTests/test_model_flattening.py | 5 +++++ ..._auto_rest_resource_flattening_test_service_operations.py | 5 +++++ ..._auto_rest_resource_flattening_test_service_operations.py | 5 +++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index c3d041c1344..4dff6d3302b 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -173,7 +173,7 @@ def in_method_signature(self) -> bool: @property def in_method_code(self) -> bool: - return not (isinstance(self.schema, ConstantSchema) and self.location == ParameterLocation.Other) + return not (self.constant and self.location == ParameterLocation.Other) @property def implementation(self) -> str: diff --git a/test/vanilla/AcceptanceTests/asynctests/test_model_flattening.py b/test/vanilla/AcceptanceTests/asynctests/test_model_flattening.py index 0d160557814..bd2de5fe53c 100644 --- a/test/vanilla/AcceptanceTests/asynctests/test_model_flattening.py +++ b/test/vanilla/AcceptanceTests/asynctests/test_model_flattening.py @@ -214,6 +214,7 @@ async def test_model_flattening_simple(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo", generic_value = "https://generic" ) @@ -230,6 +231,7 @@ async def test_model_flattening_with_parameter_flattening(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. @@ -238,6 +240,7 @@ async def test_model_flattening_with_parameter_flattening(self, client): "123", # product_id "product description", # description "max name", # max_product_display_name + "Large", # capacity None, # generic_value "http://foo", # odata_value ) @@ -252,6 +255,7 @@ async def test_model_flattening_with_grouping(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. @@ -260,6 +264,7 @@ async def test_model_flattening_with_grouping(self, client): product_id = "123", description = "product description", max_product_display_name="max name", + capacity="Large", odata_value="http://foo", name="groupproduct") diff --git a/test/vanilla/AcceptanceTests/test_model_flattening.py b/test/vanilla/AcceptanceTests/test_model_flattening.py index 0fd477f5c1e..f07085f72e9 100644 --- a/test/vanilla/AcceptanceTests/test_model_flattening.py +++ b/test/vanilla/AcceptanceTests/test_model_flattening.py @@ -208,6 +208,7 @@ def test_model_flattening_simple(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo", generic_value = "https://generic" ) @@ -223,6 +224,7 @@ def test_model_flattening_with_parameter_flattening(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. @@ -231,6 +233,7 @@ def test_model_flattening_with_parameter_flattening(self, client): "123", # product_id "product description", # description "max name", # max_product_display_name + "Large", # capacity None, # generic_value "http://foo", # odata_value ) @@ -244,6 +247,7 @@ def test_model_flattening_with_grouping(self, client): product_id = "123", description = "product description", max_product_display_name = "max name", + capacity="Large", odata_value = "http://foo" ) simple_product.additional_properties = {} # Not the purpose of this test. This enables the ==. @@ -252,6 +256,7 @@ def test_model_flattening_with_grouping(self, client): product_id = "123", description = "product description", max_product_display_name="max name", + capacity="Large", odata_value="http://foo", name="groupproduct") diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py index 1d4f8693d5a..a5f2c554752 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -454,6 +454,7 @@ async def post_flattened_simple_product( product_id: str, description: Optional[str] = None, max_product_display_name: Optional[str] = None, + capacity: Optional[str] = "Large", generic_value: Optional[str] = None, odata_value: Optional[str] = None, **kwargs: Any @@ -468,6 +469,8 @@ async def post_flattened_simple_product( :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -485,6 +488,7 @@ async def post_flattened_simple_product( product_id=product_id, description=description, max_product_display_name=max_product_display_name, + capacity=capacity, generic_value=generic_value, odata_value=odata_value, ) @@ -565,6 +569,7 @@ async def put_simple_product_with_grouping( product_id=_product_id, description=_description, max_product_display_name=_max_product_display_name, + capacity=capacity, generic_value=_generic_value, odata_value=_odata_value, ) diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py index a0c8577211c..0017fddaf60 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -487,6 +487,7 @@ def post_flattened_simple_product( product_id, # type: str description=None, # type: Optional[str] max_product_display_name=None, # type: Optional[str] + capacity="Large", # type: Optional[str] generic_value=None, # type: Optional[str] odata_value=None, # type: Optional[str] **kwargs # type: Any @@ -502,6 +503,8 @@ def post_flattened_simple_product( :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str + :param capacity: Capacity of product. For example, 4 people. + :type capacity: str :param generic_value: Generic URL value. :type generic_value: str :param odata_value: URL value. @@ -519,6 +522,7 @@ def post_flattened_simple_product( product_id=product_id, description=description, max_product_display_name=max_product_display_name, + capacity=capacity, generic_value=generic_value, odata_value=odata_value, ) @@ -602,6 +606,7 @@ def put_simple_product_with_grouping( product_id=_product_id, description=_description, max_product_display_name=_max_product_display_name, + capacity=capacity, generic_value=_generic_value, odata_value=_odata_value, ) From 5cc15dcc4f7d8b1f3f1681ad08085fef03b5d52c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 16 Jun 2021 11:19:40 -0400 Subject: [PATCH 4/7] improve docstrings for constants and optional constants in models --- .../codegen/serializers/model_base_serializer.py | 13 +++++++++---- package.json | 2 +- .../azurespecialproperties/models/_models.py | 2 +- .../azurespecialproperties/models/_models_py3.py | 2 +- .../BodyString/bodystring/models/_models.py | 3 +-- .../BodyString/bodystring/models/_models_py3.py | 3 +-- .../Constants/constants/models/_models.py | 10 ++++++---- .../Constants/constants/models/_models_py3.py | 10 ++++++---- .../modelflattening/models/_models.py | 6 ++++-- .../modelflattening/models/_models_py3.py | 6 ++++-- .../Validation/validation/models/_models.py | 13 +++++++------ .../Validation/validation/models/_models_py3.py | 13 +++++++------ 12 files changed, 48 insertions(+), 35 deletions(-) diff --git a/autorest/codegen/serializers/model_base_serializer.py b/autorest/codegen/serializers/model_base_serializer.py index 01e827c7e17..227b3dfced7 100644 --- a/autorest/codegen/serializers/model_base_serializer.py +++ b/autorest/codegen/serializers/model_base_serializer.py @@ -62,14 +62,19 @@ def prop_documentation_string(prop: Property) -> str: description += "." if prop.name == "tags": description = "A set of tags. " + description - if prop.required: + + if prop.constant: + description += f' Has constant value: {prop.constant_declaration}.' + elif prop.required: if description: description = "Required. " + description else: description = "Required. " - if prop.constant: - constant_prop = cast(ConstantSchema, prop.schema) - description += f' Default value: "{constant_prop.value}".' + elif isinstance(prop.schema, ConstantSchema): + description += ( + f" The only acceptable values to pass in are \"None\" and {prop.constant_declaration}. " + + f"The default value is {prop.constant_declaration}." + ) if prop.is_discriminator: description += "Constant filled by server. " if isinstance(prop.schema, EnumSchema): diff --git a/package.json b/package.json index d0e0e936ac3..16f05051203 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@autorest/autorest": "^3.0.0", - "@microsoft.azure/autorest.testserver": "^3.0.23" + "@microsoft.azure/autorest.testserver": "^3.0.24" }, "files": [ "autorest/**/*.py", diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py index 15c69f1847d..7aaa9669255 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py @@ -19,7 +19,7 @@ class Error(msrest.serialization.Model): :param status: :type status: int - :ivar constant_id: Required. Default value: "1". + :ivar constant_id: Has constant value: 1. :vartype constant_id: int :param message: :type message: str diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py index c8380361c06..806724b999b 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py @@ -21,7 +21,7 @@ class Error(msrest.serialization.Model): :param status: :type status: int - :ivar constant_id: Required. Default value: "1". + :ivar constant_id: Has constant value: 1. :vartype constant_id: int :param message: :type message: str diff --git a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py index f378cc31f39..50bae4d73a0 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py @@ -37,8 +37,7 @@ class RefColorConstant(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar color_constant: Required. Referenced Color Constant Description. Default value: - "green-color". + :ivar color_constant: Referenced Color Constant Description. Has constant value: "green-color". :vartype color_constant: str :param field1: Sample string. :type field1: str diff --git a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py index 9fa4e50bc63..236df42ec85 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py @@ -39,8 +39,7 @@ class RefColorConstant(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar color_constant: Required. Referenced Color Constant Description. Default value: - "green-color". + :ivar color_constant: Referenced Color Constant Description. Has constant value: "green-color". :vartype color_constant: str :param field1: Sample string. :type field1: str diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py index a7569b538be..5bc76165e45 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py @@ -164,7 +164,8 @@ def __init__(self, **kwargs): class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - :param parameter: + :param parameter: The only acceptable values to pass in are "None" and "value1". The default + value is "value1". :type parameter: str """ @@ -180,7 +181,8 @@ def __init__(self, **kwargs): class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - :param parameter: + :param parameter: The only acceptable values to pass in are "None" and "value1". The default + value is "value1". :type parameter: str """ @@ -232,7 +234,7 @@ class NoModelAsStringRequiredOneValueDefault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar parameter: Required. Default value: "value1". + :ivar parameter: Has constant value: "value1". :vartype parameter: str """ @@ -257,7 +259,7 @@ class NoModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar parameter: Required. Default value: "value1". + :ivar parameter: Has constant value: "value1". :vartype parameter: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py index 7e87b53dd80..b23097c196f 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py @@ -176,7 +176,8 @@ def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredTwoValueNoDefa class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - :param parameter: + :param parameter: The only acceptable values to pass in are "None" and "value1". The default + value is "value1". :type parameter: str """ @@ -192,7 +193,8 @@ def __init__(self, *, parameter: Optional[str] = "value1", **kwargs): class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - :param parameter: + :param parameter: The only acceptable values to pass in are "None" and "value1". The default + value is "value1". :type parameter: str """ @@ -248,7 +250,7 @@ class NoModelAsStringRequiredOneValueDefault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar parameter: Required. Default value: "value1". + :ivar parameter: Has constant value: "value1". :vartype parameter: str """ @@ -273,7 +275,7 @@ class NoModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar parameter: Required. Default value: "value1". + :ivar parameter: Has constant value: "value1". :vartype parameter: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py index d01e4c43364..c4f131f56fa 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py @@ -173,7 +173,8 @@ class FlattenParameterGroup(msrest.serialization.Model): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :param capacity: Capacity of product. For example, 4 people. + :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass + in are "None" and "Large". The default value is "Large". :type capacity: str :param generic_value: Generic URL value. :type generic_value: str @@ -297,7 +298,8 @@ class SimpleProduct(BaseProduct): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :param capacity: Capacity of product. For example, 4 people. + :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass + in are "None" and "Large". The default value is "Large". :type capacity: str :param generic_value: Generic URL value. :type generic_value: str diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py index cdc49822cdc..0adb85fbdc8 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py @@ -191,7 +191,8 @@ class FlattenParameterGroup(msrest.serialization.Model): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :param capacity: Capacity of product. For example, 4 people. + :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass + in are "None" and "Large". The default value is "Large". :type capacity: str :param generic_value: Generic URL value. :type generic_value: str @@ -334,7 +335,8 @@ class SimpleProduct(BaseProduct): :type description: str :param max_product_display_name: Display name of product. :type max_product_display_name: str - :param capacity: Capacity of product. For example, 4 people. + :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass + in are "None" and "Large". The default value is "Large". :type capacity: str :param generic_value: Generic URL value. :type generic_value: str diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py index 89db56f7ac2..3c4a02a855b 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py @@ -17,7 +17,7 @@ class ChildProduct(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar const_property: Required. Constant string. Default value: "constant". + :ivar const_property: Constant string. Has constant value: "constant". :vartype const_property: str :param count: Count. :type count: int @@ -46,9 +46,9 @@ class ConstantProduct(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar const_property: Required. Constant string. Default value: "constant". + :ivar const_property: Constant string. Has constant value: "constant". :vartype const_property: str - :ivar const_property2: Required. Constant string2. Default value: "constant2". + :ivar const_property2: Constant string2. Has constant value: "constant2". :vartype const_property2: str """ @@ -110,11 +110,12 @@ class Product(msrest.serialization.Model): :type child: ~validation.models.ChildProduct :param const_child: Required. The product documentation. :type const_child: ~validation.models.ConstantProduct - :ivar const_int: Required. Constant int. Default value: "0". + :ivar const_int: Constant int. Has constant value: 0. :vartype const_int: int - :ivar const_string: Required. Constant string. Default value: "constant". + :ivar const_string: Constant string. Has constant value: "constant". :vartype const_string: str - :param const_string_as_enum: Constant string as Enum. + :param const_string_as_enum: Constant string as Enum. The only acceptable values to pass in are + "None" and "constant_string_as_enum". The default value is "constant_string_as_enum". :type const_string_as_enum: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py index 647b9123edb..5fcaee1ab88 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py @@ -19,7 +19,7 @@ class ChildProduct(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar const_property: Required. Constant string. Default value: "constant". + :ivar const_property: Constant string. Has constant value: "constant". :vartype const_property: str :param count: Count. :type count: int @@ -48,9 +48,9 @@ class ConstantProduct(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar const_property: Required. Constant string. Default value: "constant". + :ivar const_property: Constant string. Has constant value: "constant". :vartype const_property: str - :ivar const_property2: Required. Constant string2. Default value: "constant2". + :ivar const_property2: Constant string2. Has constant value: "constant2". :vartype const_property2: str """ @@ -114,11 +114,12 @@ class Product(msrest.serialization.Model): :type child: ~validation.models.ChildProduct :param const_child: Required. The product documentation. :type const_child: ~validation.models.ConstantProduct - :ivar const_int: Required. Constant int. Default value: "0". + :ivar const_int: Constant int. Has constant value: 0. :vartype const_int: int - :ivar const_string: Required. Constant string. Default value: "constant". + :ivar const_string: Constant string. Has constant value: "constant". :vartype const_string: str - :param const_string_as_enum: Constant string as Enum. + :param const_string_as_enum: Constant string as Enum. The only acceptable values to pass in are + "None" and "constant_string_as_enum". The default value is "constant_string_as_enum". :type const_string_as_enum: str """ From 9ff9973bb8067dfc3dc1af3fa82a5b0d4e9f039c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 16 Jun 2021 16:57:01 -0400 Subject: [PATCH 5/7] remove quotes from None and fix default value declaration --- autorest/codegen/serializers/model_base_serializer.py | 4 ++-- .../AcceptanceTests/Constants/constants/models/_models.py | 6 +++--- .../Constants/constants/models/_models_py3.py | 6 +++--- .../ModelFlattening/modelflattening/models/_models.py | 4 ++-- .../ModelFlattening/modelflattening/models/_models_py3.py | 4 ++-- .../AcceptanceTests/Validation/validation/models/_models.py | 2 +- .../Validation/validation/models/_models_py3.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/autorest/codegen/serializers/model_base_serializer.py b/autorest/codegen/serializers/model_base_serializer.py index 227b3dfced7..8a798d86542 100644 --- a/autorest/codegen/serializers/model_base_serializer.py +++ b/autorest/codegen/serializers/model_base_serializer.py @@ -72,8 +72,8 @@ def prop_documentation_string(prop: Property) -> str: description = "Required. " elif isinstance(prop.schema, ConstantSchema): description += ( - f" The only acceptable values to pass in are \"None\" and {prop.constant_declaration}. " + - f"The default value is {prop.constant_declaration}." + f" The only acceptable values to pass in are None and {prop.constant_declaration}. " + + f"The default value is {prop.default_value_declaration}." ) if prop.is_discriminator: description += "Constant filled by server. " diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py index 5bc76165e45..2c36e865ba5 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models.py @@ -164,7 +164,7 @@ def __init__(self, **kwargs): class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - :param parameter: The only acceptable values to pass in are "None" and "value1". The default + :param parameter: The only acceptable values to pass in are None and "value1". The default value is "value1". :type parameter: str """ @@ -181,8 +181,8 @@ def __init__(self, **kwargs): class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - :param parameter: The only acceptable values to pass in are "None" and "value1". The default - value is "value1". + :param parameter: The only acceptable values to pass in are None and "value1". The default + value is None. :type parameter: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py index b23097c196f..c62571056ea 100644 --- a/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py @@ -176,7 +176,7 @@ def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredTwoValueNoDefa class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueDefault. - :param parameter: The only acceptable values to pass in are "None" and "value1". The default + :param parameter: The only acceptable values to pass in are None and "value1". The default value is "value1". :type parameter: str """ @@ -193,8 +193,8 @@ def __init__(self, *, parameter: Optional[str] = "value1", **kwargs): class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """NoModelAsStringNoRequiredOneValueNoDefault. - :param parameter: The only acceptable values to pass in are "None" and "value1". The default - value is "value1". + :param parameter: The only acceptable values to pass in are None and "value1". The default + value is None. :type parameter: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py index c4f131f56fa..1db7dc4c8bf 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py @@ -174,7 +174,7 @@ class FlattenParameterGroup(msrest.serialization.Model): :param max_product_display_name: Display name of product. :type max_product_display_name: str :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass - in are "None" and "Large". The default value is "Large". + in are None and "Large". The default value is None. :type capacity: str :param generic_value: Generic URL value. :type generic_value: str @@ -299,7 +299,7 @@ class SimpleProduct(BaseProduct): :param max_product_display_name: Display name of product. :type max_product_display_name: str :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass - in are "None" and "Large". The default value is "Large". + in are None and "Large". The default value is None. :type capacity: str :param generic_value: Generic URL value. :type generic_value: str diff --git a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py index 0adb85fbdc8..356b1ea37bf 100644 --- a/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py @@ -192,7 +192,7 @@ class FlattenParameterGroup(msrest.serialization.Model): :param max_product_display_name: Display name of product. :type max_product_display_name: str :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass - in are "None" and "Large". The default value is "Large". + in are None and "Large". The default value is None. :type capacity: str :param generic_value: Generic URL value. :type generic_value: str @@ -336,7 +336,7 @@ class SimpleProduct(BaseProduct): :param max_product_display_name: Display name of product. :type max_product_display_name: str :param capacity: Capacity of product. For example, 4 people. The only acceptable values to pass - in are "None" and "Large". The default value is "Large". + in are None and "Large". The default value is None. :type capacity: str :param generic_value: Generic URL value. :type generic_value: str diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py index 3c4a02a855b..b517ba12c17 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models.py @@ -115,7 +115,7 @@ class Product(msrest.serialization.Model): :ivar const_string: Constant string. Has constant value: "constant". :vartype const_string: str :param const_string_as_enum: Constant string as Enum. The only acceptable values to pass in are - "None" and "constant_string_as_enum". The default value is "constant_string_as_enum". + None and "constant_string_as_enum". The default value is None. :type const_string_as_enum: str """ diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py index 5fcaee1ab88..0e77bb9c137 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py @@ -119,7 +119,7 @@ class Product(msrest.serialization.Model): :ivar const_string: Constant string. Has constant value: "constant". :vartype const_string: str :param const_string_as_enum: Constant string as Enum. The only acceptable values to pass in are - "None" and "constant_string_as_enum". The default value is "constant_string_as_enum". + None and "constant_string_as_enum". The default value is None. :type const_string_as_enum: str """ From 45b4dc0d20b071df3042ce7e3be19e6bf046d06d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 16 Jun 2021 16:57:33 -0400 Subject: [PATCH 6/7] prepare for release --- ChangeLog.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 41fd08bad54..708857a83f7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,6 @@ # Change Log -### 2021-06-07 - 5.8.1 +### 2021-06-16 - 5.8.1 min Autorest core version: 3.3.0 diff --git a/package.json b/package.json index 16f05051203..846fa4f0754 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/python", - "version": "5.8.0", + "version": "5.8.1", "description": "The Python extension for generators in AutoRest.", "scripts": { "prepare": "node run-python3.js prepare.py", From 9a269c24fe55a41b5e77ea1cc2132c59b283c3fd Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 16 Jun 2021 17:25:51 -0400 Subject: [PATCH 7/7] add pyyaml to dev reqs --- dev_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index 6c769311074..60f41d2031a 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -7,3 +7,4 @@ pytest ptvsd mypy black +types-PyYAML \ No newline at end of file