-
Notifications
You must be signed in to change notification settings - Fork 40
-
Hello
I'm changing the validation_error_model and this has a internal field with other model:
def create_openapi():
return OpenAPI(__name__,
info=info,
servers=servers,
doc_ui=doc_ui_enabled,
validation_error_status=400,
validation_error_model=GenericError,
validation_error_callback=validation_error_handler)
This is the generic error model:
class GenericError(BaseModel):
errorCode: str = Field(..., example="400")
message: str = Field(..., example="Bad Request")
help: str = Field(..., example="Bad Request")
location: str = Field(..., example="/path/error")
moreInfo: list[GenericTracebackError] = Field(..., example=[GenericTracebackError(
location="GenericError.py",
line=1,
method="GenericError",
message="400:Bad Request")])
And this is the model of traceback error:
class GenericTracebackError(BaseModel):
location: str = Field(..., example="GenericError.py")
line: int = Field(..., example=1)
method: str = Field(..., example="GenericError")
message: str = Field(..., example="400:Bad Request")
But the problem is that in the openapi.json file, only the GenericError model is added, the GenericTracebackError model is not automatically added:
image
And show this error:
Errors
Resolver error at components.schemas.GenericError.properties.moreInfo.items.$ref
Could not resolve reference: Could not resolve pointer: /definitions/GenericTracebackError does not exist in document
How can I manually add this model to the openapi.json schemes or how can I add it to the definitions so that the internal model is found?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
I can confirm this is a bug and I will fix it.
Beta Was this translation helpful? Give feedback.
All reactions
1 reply
-
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment