Fix for 'generate_route_manifest' CLI #740
Merged
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.
A recent FastAPI version update (around v0.128.3/4) broke the
generate_route_manifestCLI. We previously extracted a URL endpoint path parameter's type information from thetype_attribute in the path parameterModelFieldinstance, which has been removed in said recent FastAPI version update. Further inspection indicates that it is a Pydantic v1 attribute, and has been phased out as part of deprecating Pydantic v1.This PR replaces the use of the
type_attribute with the Pydantic v2_type_adapter._typeattribute, which contains the full type annotation of the path parameter. A helper function was introduced to extract the basic Python type from the annotation.