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
When using io.swagger.v3.core.filter.SpecFilter.removeBrokenReferenceDefinitions on the provided OpenAPI 3.1.0 specification, the function is incorrectly removing the RequestDto schema definition from the components.schemas section. The schema is still referenced in the webhook newPet request body, but the actual schema definition is removed from the OpenAPI spec, resulting in a broken reference.
Input OpenAPI Spec:
The original OpenAPI specification includes a schema definition RequestDto under the components.schemas, which is referenced by the newPet webhook's request body schema.
openapi: 3.1.0info:
title: OpenAPI definitionversion: v0servers:
- url: http://localhostdescription: Generated server urlpaths: {}components:
schemas:
RequestDto:
properties:
personalNumber:
type: stringwebhooks:
newPet:
post:
requestBody:
description: Information about a new pet in the systemcontent:
application/json:
schema:
$ref: '#/components/schemas/RequestDto'description: Webhook Petresponses:
'200':
description: >- Return a 200 status to indicate that the data was received successfully
Generated OpenAPI Spec:
After using the removeBrokenReferenceDefinitions method, the resulting OpenAPI spec incorrectly removes the RequestDto schema from the components.schemas section, even though it is still referenced. This causes a broken reference in the generated spec:
openapi: 3.1.0info:
title: OpenAPI definitionversion: v0servers:
- url: http://localhostdescription: Generated server urlpaths: {}components:
schemas: {}webhooks:
newPet:
post:
requestBody:
description: Information about a new pet in the systemcontent:
application/json:
schema:
$ref: '#/components/schemas/RequestDto'description: Webhook Petresponses:
'200':
description: >- Return a 200 status to indicate that the data was received successfully
Expected Result
The SpecFilter.removeBrokenReferenceDefinitions method should retain schema definitions that are referenced in other parts of the OpenAPI specification (such as in webhooks, request bodies, or responses). In this case, since the RequestDto schema is being referenced in the newPet webhook, the method should not remove the RequestDto schema from the components.schemas section.
The expected behavior is as follows:
The RequestDto schema should remain in the components.schemas section, as it is actively referenced in the webhook newPet.
The text was updated successfully, but these errors were encountered:
Hi @bnasslahsen thank you for reporting the issue ! It should be solved by: #4762, I am closing this ticket for now, If there will be still any questions feel free to reopen.
When using
io.swagger.v3.core.filter.SpecFilter.removeBrokenReferenceDefinitions
on the provided OpenAPI 3.1.0 specification, the function is incorrectly removing theRequestDto
schema definition from the components.schemas section. The schema is still referenced in the webhook newPet request body, but the actual schema definition is removed from the OpenAPI spec, resulting in a broken reference.Input OpenAPI Spec:
The original OpenAPI specification includes a schema definition
RequestDto
under the components.schemas, which is referenced by the newPet webhook's request body schema.Generated OpenAPI Spec:
After using the removeBrokenReferenceDefinitions method, the resulting OpenAPI spec incorrectly removes the RequestDto schema from the components.schemas section, even though it is still referenced. This causes a broken reference in the generated spec:
Expected Result
The
SpecFilter.removeBrokenReferenceDefinitions
method should retain schema definitions that are referenced in other parts of the OpenAPI specification (such as in webhooks, request bodies, or responses). In this case, since theRequestDto
schema is being referenced in the newPet webhook, the method should not remove theRequestDto
schema from the components.schemas section.The expected behavior is as follows:
The
RequestDto
schema should remain in the components.schemas section, as it is actively referenced in the webhook newPet.The text was updated successfully, but these errors were encountered: