Skip to content

fix: resolve resSchema namespace for shared response schemas#72

Open
arlindaxhemailii wants to merge 1 commit into
feat/3.0.0from
fix/shared-response-schema-namespace
Open

fix: resolve resSchema namespace for shared response schemas#72
arlindaxhemailii wants to merge 1 commit into
feat/3.0.0from
fix/shared-response-schema-namespace

Conversation

@arlindaxhemailii
Copy link
Copy Markdown
Collaborator

When a response schema is shared across multiple tags, the resolver correctly assigns it to the default (Common) namespace. However, passing the endpoint tag as namespaceTag to getImportedZodSchemaName bypassed this resolution logic and forced the schema into the endpoint's namespace.

As a result, shared schemas such as StatusResponseSchema were emitted as:

  • RocketsModels.StatusResponseSchema

instead of:

  • CommonModels.StatusResponseSchema

This left resSchema undefined at runtime, causing successful responses to fail validation and surface as openapi.sharedErrors.unknownError.

This fixes the regression introduced in 3.0.0 by removing the namespaceTag override for response schemas and restoring automatic namespace resolution through getTagByZodSchemaName.

Also adds regression tests covering both resolution paths:

  • Shared schema used across multiple tags → CommonModels
  • Schema owned by a single tag → owning tag namespace (RocketsModels)

@arlindaxhemailii arlindaxhemailii requested a review from xban1x June 4, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant