-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Open-API: Error response in the spec don’t align with the expected model. #8914
Conversation
cc @amogh-jahagirdar @nastra seems like a miss in the spec, unless the OpenAPI error response requires the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for fixing this @geruh
{ | ||
"error": { | ||
"message": "The server does not support this operation", | ||
"type": "UnsupportedOperationException", | ||
"code": 406 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is in line with the PyIceberg implementation:
class ErrorResponseMessage(IcebergBaseModel):
message: str = Field()
type: str = Field()
code: int = Field()
class ErrorResponse(IcebergBaseModel):
error: ErrorResponseMessage = Field()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
thanks for the fix, and thanks for the reviews! |
When generating a REST client using the current OpenAPI specification, the non-200 Iceberg error responses are defined as:
However, the provided examples in the spec correctly enclose the error details within an error JSON node:
Iceberg error responses point to the
ErrorModel
as their schema, as seen here. Following the current convention and returning the above-stated non-200 error structure to the client results in a precondition failure within the ErrorResponseParser. This is due to the parsers expectation for all error responses to be wrapped within the error JSON node.example: https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L2444
Testing