DM-47769: Refactor Wobbly schema to support Pydantic #11
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.
Instead of writing an explicit object conversion function, rework the Wobbly schema so that ORM objects can be converted directly to Pydantic objects using
model_validate
. This requires moving the ordering of results into the ORM rather than doing it manually, moving the error attributes into a table and allowing more than one error, and reworking the schema for results to avoid an autogenerated key that clashes with the client-provided result ID.UWS does not allow multiple errors in the current schema, but any revision of the standard should ideally support multiple errors. For now, we can follow the convention of storing at most one error and not use this schema functionality, but since it makes the Pydantic integration easier, it seemed better to future-proof now.
Change the cascade configuration of the job ORM model to ensure that any orphaned result or error objects are deleted, which was already required by the schema.