Skip to content
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

DM-38414: Switch to Safir 4.0.0 #735

Merged
merged 5 commits into from
Apr 19, 2023
Merged

DM-38414: Switch to Safir 4.0.0 #735

merged 5 commits into from
Apr 19, 2023

Conversation

rra
Copy link
Member

@rra rra commented Apr 19, 2023

Update to Safir 4.0.0, adjust for its backward-incompatible changes, and use the exception infrastructure from Safir now that it has been imported there (with some modifications).

Enable autodoc_pydantic to generate better documentation of Pydantic models. This also seems to be required for proper cross-referencing to Safir documentation now that Safir is also using autodoc_pydantic.

rra added 5 commits April 19, 2023 10:59
validate_exactly_one_of is now a root validator rather than a
regular validator. Update Gafaelfawr's models accordingly.
Now that SlackWebException has been imported into Safir, use it
from there rather than rolling our own. This results in some minor
improvements in how errors are reported to Slack.
Gafaelfawr was using ValidationError as a base class that knew how
to format itself into a FastAPI-compatible error message. Safir now
offers ClientRequestError based on this code that does the same thing,
so rename ValidationError to InputValidationError (to avoid the
conflict with Pydantic's exception) and inherit from that exception.

Use inheritance rather than simply replacing it since Gafaelfawr
also wants to tag this exception as kopf.PermanentError.

Adjust for the different calling convention for ClientRequestError
(a list of field path).
Several classes had symbols that weren't mentioned in __all__,
and gafaelfawr.class had an internal variable that didn't have an
underscore prefix. Caught when testing an alternate documentation
generation method with autosummary.
Generate API documentation with autodoc_pydantic, which generates
much better documentation for Pydantic models. Enable inherited
members for all module documentation, since module hierarchies
generally should merge all of their fields for documentation
purposes.
@rra rra merged commit 11a2c8d into main Apr 19, 2023
@rra rra deleted the tickets/DM-38414a branch April 19, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant