Components from Other Modules Exported in OpenAPI Spec

I’m facing an issue with the OpenAPI spec export.

In my project, responses are defined under components within specific modules. However, when exporting the spec for endpoints from one module, the response components from other unrelated modules are also included in the exported specification.This causes unnecessary components to appear in the spec.

Could you please look into this and fix the behavior so that only the components defined in the same module as the exported endpoint are included in the generated OpenAPI specification?

Hello, if the current module references response components from other modules, the referenced components will be automatically included when exporting the OpenAPI specification.

If you want the exported result to only retain the components defined within the current module itself, we recommend:

  1. Checking whether the interface responses indeed only use components from this module;
  2. Avoiding references to definitions from other unrelated modules within this module.

Hi,
The interface responses only use components from the same module and there are no references to another module.
When i created a new response component in another module which is not referenced anywhere, it still got exported in the OpenAPI spec while exporting an endpoint from this module.

Thank you for your feedback, we will locate and resolve your issue.