-
Notifications
You must be signed in to change notification settings - Fork 616
Add deprecated field to Input #2360
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
Conversation
- Allow inputs to be marked as deprecated
- If they are, declare them deprecated in the openapi schema
* Allow inputs to be marked as deprecated * If they are, declare them deprecated in the openapi schema
@@ -73,6 +73,7 @@ def Input( # pylint: disable=invalid-name, too-many-arguments | |||
max_length: Optional[int] = None, | |||
regex: Optional[str] = None, | |||
choices: Optional[List[Union[str, int]]] = None, | |||
deprecated: Optional[bool] = 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.
Does this need to be optional? Couldn't it be this?
deprecated: Optional[bool] = None, | |
deprecated: bool = False, |
and only set field_kwargs["deprecated"]
at all if it's True
?
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.
I'd rather it be Optional
to minimise the impact to the openapi schema unless the user wants to explicitly declare the deprecation
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.
That's what I mean, too. Only ever set field_kwargs["deprecated"] = True
if deprecated == True
, otherwise, treat False
like you currently treat 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.
I think Optional
captures this behaviour in a clearer way, only writing the new field if it is explicitly invoked by the user.
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.
Fair enough