You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as possible I let springdoc-openapi autogenerate my OpenAPI specification, that is without my intervention. But examples need to be provided manually, because the autogenerated examples do not contain sensible values:
That compiles, but gives me a runtime error. Even though the type of the request body, defined as @RequestBody in the controller method, is actually known (and even used for the autogenerated example if I do not specify my own).
I need to add schema = @Schema(implementation = MyRequestBody.class) (which is redundant and unchecked, thus can lead to a discrepancy between springdoc-openapi annotation and the actual controller method). And even if I explicitly specify the schema, the example JSON is not validated (not parsed?) using that schema.
There is no strict requirement in the OpenAPI-Specification to validate the example compatibility with a schema.
We do not choose to integrate this validation on springdoc-openapi.
If the swagger-api integrates it, we will then reuse it.
I think that feature is not related to the specification, but is perfectly obvious because an invalid example is useless.
If I manually write the OpenAPI specification, then it is difficult to validate my examples. But if the specification is auto-generated, the developer expects the generator to check what it produces.
It does not necessarily have something to do with whether Swagger integrates that validation or not.
As far as possible I let springdoc-openapi autogenerate my OpenAPI specification, that is without my intervention. But examples need to be provided manually, because the autogenerated examples do not contain sensible values:
That compiles, but gives me a runtime error. Even though the type of the request body, defined as
@RequestBody
in the controller method, is actually known (and even used for the autogenerated example if I do not specify my own).I need to add
schema = @Schema(implementation = MyRequestBody.class)
(which is redundant and unchecked, thus can lead to a discrepancy between springdoc-openapi annotation and the actual controller method). And even if I explicitly specify the schema, the example JSON is not validated (not parsed?) using that schema.Definition of done:
MyRequestBody
as the schema classThe text was updated successfully, but these errors were encountered: