Skip to content

fix: exempt x-domain-error-domain schemas from inline enum validation#73

Open
arlindaxhemailii wants to merge 1 commit into
feat/3.0.0from
fix/domain-error-inline-enum-validation
Open

fix: exempt x-domain-error-domain schemas from inline enum validation#73
arlindaxhemailii wants to merge 1 commit into
feat/3.0.0from
fix/domain-error-inline-enum-validation

Conversation

@arlindaxhemailii
Copy link
Copy Markdown
Collaborator

Problem

Domain error response schemas generated by @ApiDomainErrorResponse intentionally contain inline enum properties:

status: { enum: ["error"] }
code: { enum: [<n>] }

These enums are used as a discriminator (status) and as the domain error identity (code).

The inline enum validator currently processes all response schemas, including domain error schemas marked with x-domain-error-domain. As a result, these intentional inline enums produce not-allowed-inline-enum validation errors, causing openapi-codegen check (and therefore check:ci) to fail.

Fix

Skip inline enum extraction/validation for schemas marked with x-domain-error-domain.

This extension is emitted only by @ApiDomainErrorResponse, making the guard precise and scoped to domain error schemas.

Domain error code extraction remains unaffected, as it reads code.enum directly from the raw schema object and does not depend on the enum extraction pipeline.

Side Effects

  • StatusEnumSchema and CodeEnumSchema are no longer generated for domain error response schemas.
  • Launch400ErrorResponseSchema.status is generated as z.enum(["error"]) instead of referencing StatusEnumSchema.
  • Runtime validation semantics remain unchanged.

Tests

  • Domain error schemas (x-domain-error-domain present) do not produce not-allowed-inline-enum validation errors.
  • Normal inline enums continue to produce validation errors.
  • Generated output uses inline z.enum(["error"]) and does not reference removed enum schemas.

@arlindaxhemailii arlindaxhemailii requested review from izakgl and xban1x June 4, 2026 12:49
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