-
Notifications
You must be signed in to change notification settings - Fork 19
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
Minor fix to v0.3.0 I/O models #1128
Conversation
Adds data models that will be needed for v0.3.0 of the superstaq server --------- Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
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.
lgtm!
@@ -264,13 +265,13 @@ class UserQuery(DefaultPydanticModel): | |||
"""Model for querying the database to retrieve users. Use of lists implied logical OR. Providing | |||
multiple fields (e.g. name and email) implies logical AND.""" | |||
|
|||
name: list[str] | None = pydantic.Field(None) | |||
name: Sequence[str] | None = pydantic.Field(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.
why Sequence? i thought pydantic should convert/cast the input so generic types shouldn't be necessary
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.
On server side this model gets subclassed to introduce a checks for enums not exposed to the client side. Therefore the type needs to be covariant - hence Sequence. Strictly speaking not required for all fields but I thought it would be neater to apply to all.
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.
ah ok makes sense!
Correcting a small typing mistake and fixing naming.