Skip to content
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

Merged
merged 4 commits into from
Dec 16, 2024
Merged

Conversation

cdbf1
Copy link
Contributor

@cdbf1 cdbf1 commented Dec 13, 2024

Correcting a small typing mistake and fixing naming.

cdbf1 and others added 3 commits December 13, 2024 15:34
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>
Copy link
Contributor

@dowusu-antwi dowusu-antwi left a 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)
Copy link
Contributor

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

Copy link
Contributor Author

@cdbf1 cdbf1 Dec 13, 2024

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok makes sense!

@cdbf1 cdbf1 merged commit d0bd65b into main Dec 16, 2024
21 checks passed
@cdbf1 cdbf1 deleted the feature/minor_fix_to_v0_3_0_models branch December 16, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants