-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support enum #167
Comments
I am interested in working on this issue. |
What is supported
What is not supported
High Level FlowOpenAlchemy follows the following high level steps to produce output:
For now, we will park step 4 and 5 for later ValidationThe functionality for validation is defined in the following folder: open_alchemy/schemas/validation The first step is break down the problem first to individual schemas and then to properties within those schemas. Then, there are a few different types of properties which is used to break down the problem a little further. The types are:
In this case we only need to worry about open_alchemy/schemas/validation/property_/simple.py This function needs to be modified to do the following checks if a property defines
These checks should be performed after all other checks so that you can assume that the schema is otherwise valid. I was looking for a function that could help with the item validation, the best I could find is that something similar is being done for the Other typesFor ArtefactsAfter validation passes, OpenAlchemy converts the schema into well-defined artefacts data classes. The relevant folder is: open_alchemy/schemas/artifacts Again, the problem is broken down in a similar way as for validation. The relevant file to update is: open_alchemy/schemas/artifacts/property_/simple.py Additionally, the class that is returned has to be updated. The class is SQLAlchemy model constructionTo construct the SQLAlchemy model, the artefacts class needs to be converted to a SQLAlchemy open_alchemy/facades/sqlalchemy/simple.py The mapping should be done to the following SQLAlchemy type: https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqlalchemy.types.Enum ExampleTo verify that everything works up to this point, create an example in the following folder: And add a test to the following file: tests/examples/test_example_specs.py Next StepsThis is potentially enough to do an initial pull request. If you like, after completing each stage (e.g. validation), it would also be fine to do a pull request and have that stage merged into master, it won't break anything (assuming all tests pass) and it means you can more easily keep up with any changes on the master branch. Let's reconnect after this, there are a few more things that we need to do:
|
Hi! Any news? |
As a user I want to define a list of valid values for a variable so that only those values are accepted.
Reference to the OpenAPI documentation: https://swagger.io/docs/specification/data-models/enums/
Requested in #166
The text was updated successfully, but these errors were encountered: