-
Notifications
You must be signed in to change notification settings - Fork 5
Bits and pieces on openapi implementation #27
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…a in sql_models.py and schmemas.py caused troubles for autogenerated Python client API. For now, resorted to suboptimal suffix "SQLAlchemy" for the schemata defined within sql_models.py. Do we need actually need the different schema in sql_models.BaseURISQLAlchemySchema(ma.SQLAlchemyAutoSchema) and schemas.class BaseURISchema(Schema) ? * sql_models.Dataset(db.Model) defines columns frozen_at and created_at as db.DateTime(), its method as_dict() converts those with dtoolcore.utils.timestamp(self.frozen_at). This, however, results in the autogenerated client API to expect a serialized datetime object and throw an exception when receiving float. For now, inverted the previos behavior of the server to always return timestamps as floats to returning datetime objects instead. What should be the way here in the future? * Standardized spelling of Uri to URI in models and schema for all occurences.
Member
Author
|
An instance of this branch runs at https://demo.dtool.dev/, with openapi docs at https://demo.dtool.dev/lookup/doc/swagger, would like to discuss. |
This was referenced Nov 13, 2022
Merged
Member
Author
|
Broke what's left here down into several small pull requests,
Closing this one. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an old pull request I had still open on Luis' fork (ljyanesm#1), with a few points not discussed yet. Below I copy over what I still find relevant. A few of the issues described arose when playing with auto-generating Python API from the openapi specs (https://github.com/jotelha/dtool-lookup-server/tree/0de6f54d0912c79740c9089228f2c5c764babf26/devel).
UritoURIin models and schema for all occurrences.URIacronym likeBaseURI,BaseUri,BaseURISchema, andBaseUriSchemainsql_models.pyandschemas.pycaused troubles for autogenerated Python client API. For now, resorted to suffixSQLAlchemyfor the schema defined withinsql_models.pydue to a lack of imagination. Do we actually need the different schema insql_models.BaseURISQLAlchemySchema(ma.SQLAlchemyAutoSchema)andschemas.BaseURISchema(Schema)?sql_models.Dataset(db.Model)defines columnsfrozen_atand created_at as db.DateTime(), its methodas_dict()converts those withdtoolcore.utils.timestamp(self.frozen_at). This, however, results in the autogenerated client API to expect a serializeddatetimeobject and to throw an exception when receivingfloat. Treatcreated_atandfrozen_atas floats in schema withhttps://github.com/jotelha/dtool-lookup-server/blob/9d1b8cc751f1d1e143bae10d9454d86be438dc13/dtool_lookup_server/sql_models.py#L122-L128 as suggested below https://marshmallow.readthedocs.io/en/latest/quickstart.html#implicit-field-creation. Not sure whether this is legitimate.
treat UUIDs as string for now, keep https://pymongo.readthedocs.io/en/stable/examples/uuid.html#handling-uuid-data in mind.