-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if constant is optional, don't force to value #952
Changes from 3 commits
fe7381d
47ba074
bf29f73
5cc15dc
9ff9973
45b4dc0
9a269c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
: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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. swagger. This is an optional constant with no default, so we default to The doc should also be improved here, so we show the one non- There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add docstring fix to this PR |
||
: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): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as you'll notice, the default for optional constants in the method signature is a value. This has to do with this issue. Still need to find a good non-breaking way around this |
||
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, | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. swagger. Since current behavior of enum is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ask tim about whether |
||
: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,15 +197,14 @@ 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"] | ||
self.simple_body_product = kwargs.get("simple_body_product", None) | ||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same param as above |
||
: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) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decided to make
constant
andvalidation_map
readonly properties to unclutter the main__init__
and because we don't set them later