Add pre and post processing scripts for schema generation #9226
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.
The biggest blocker I'm running into trying to address #9045 is that a number of fields are conditionally removed from the serializers depending on what view is calling it like this:
The schema generator doesn't seem to handle this case at all, so any field that is conditionally removed is excluded from the schema entirely. That leaves me with a schema that doesn't define a
notes
field so when one is included in a details query the generated code reports it as an error (and certainly offers no way to view the data).I haven't been able to figure out a programmatic way to detect when schema generation is happening to not remove the fields, nor have a found a configuration that affects this behavior.
The included scripts work, but they aren't integrated in any way. I'm opening this as a draft PR to ask if it's worth finding a way to integrate this into the
invoke dev.schema ...
command or if there's a better path I should be going down.The scripts are intended to be used as follows: