Add auto-generated Configuration schema from Pydantic model - #16518
Draft
davelopez wants to merge 28 commits into
Draft
Add auto-generated Configuration schema from Pydantic model#16518davelopez wants to merge 28 commits into
davelopez wants to merge 28 commits into
Conversation
Member
This is amazing, I love it. How about we turn this around and make the pydantic model the source of truth from which we generate the other stuff ... it should be much more expressive than what we have currently, and the model_validators would let us for instance easily flag stuff that can't be combined. And we can easily define what can and can't be exposed through the API inline. |
Contributor
Author
|
Thanks so much @mvdbeek! That is exactly what I needed to hear 😄 👍 |
davelopez
force-pushed
the
add_configuration_api_schema_model
branch
from
August 6, 2023 12:03
609401b to
7efd287
Compare
davelopez
force-pushed
the
add_configuration_api_schema_model
branch
6 times, most recently
from
August 10, 2023 13:05
a18cb33 to
329989c
Compare
davelopez
force-pushed
the
add_configuration_api_schema_model
branch
from
August 23, 2023 18:18
91d7206 to
7a20cd0
Compare
From the configuration schema.
And invoke `config-api-schema` when building the config options and updating the client API schema.
This model is not yet properly generated as it exposes everything.
- Fix some encoding issues - Use Annotated for fields
This reverts commit 554ddee.
See test/integration/test_data_manager.py::TestDataManagerIntegration::test_data_manager_installation_table_reload
The documentation says that the option is called `extended_celery` but the tests were using `celery_extended`. The logic will accept both options, but the tests should be consistent with the documentation.
The validation logic needs to live in the manager class because otherwise the configuration package will need to depend on the schema, pydantic, etc.
When validating the config file, is a list of objects but when serialized to the API is a dictionary.
The option `use_remote_user` was used an declared as bool in the codebase, but it was assigned the value of `single_user` in some cases and that option can be either a bool or an email address (str) causing the type validation to fail.
This is somewhat controversial, but otherwise the generated schema will have weird spacing and unwanted line breaks in all descriptions.
davelopez
force-pushed
the
add_configuration_api_schema_model
branch
from
September 11, 2023 16:04
c9a6794 to
b27ee9a
Compare
Member
|
Discussed this in the backend channel, we're all on board with having the pydantic models as the source of truth, and that if necessary, we can replace the tooling built on pykwalify. |
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
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.
Follow up to #16514
I was manually creating the model when I realized we already have the
config_schema.yml. It would be much easier to maintain if we could update the model whenever we introduce a new config parameter. As wisely suggested by Marius, I will approach this by first generating the initial basic Pydantic Model from the config schema, and then, the idea is to use the model as the single source of truth and generate the schema from it.TODO
config_schema.ymlviewsof the Configuration model, initially:ComputedGalaxyConfigwith admin-only options.tool_shed_urlsdirectly from the API #16561 in modelby_hostdynamic config options into account Allow various configuration parameters to be set per host. #12328path_resolves_tooptionsreloadableoptionsuse_remote_usergetting a string (email) instead of a boolean as a value assigned from thesingle_useroption in some cases. I decided to fix it by casting to the bool value which is more explicit c9a6794config_schema.ymlfrom theFullmodelHow to test the changes?
(Select all options that apply)
License