Skip to content

Align OpenAPI schema examples with raw SchemaObject shape#2001

Merged
samchon merged 3 commits into
masterfrom
fix/openapi-schema-examples-type
Jul 5, 2026
Merged

Align OpenAPI schema examples with raw SchemaObject shape#2001
samchon merged 3 commits into
masterfrom
fix/openapi-schema-examples-type

Conversation

@samchon

@samchon samchon commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • narrow raw OpenAPI Schema Object examples types to array-shaped values for v3.0/v3.1/v3.2
  • convert typia's emended named schema examples to raw arrays in OpenAPI 3.0/3.1 downgrade paths
  • document the emended-schema vs raw-OpenAPI boundary and add downgrade regression tests

Discussion

Validation

  • pnpm format
  • pnpm build
  • node smoke test against built OpenApiConverter.downgradeSchema for v3.0/v3.1 schema examples
  • pnpm run build from website/

Local Gap

  • Filtered tests/test-utils execution timed out locally in ttsx project check before test execution; the new behavior was still checked via package build plus compiled converter smoke test.

typia's emended schema keeps named examples so converters can preserve labels internally, while raw OpenAPI Schema Objects expose array-shaped examples. The downgrade path now drops names at the raw boundary and the schema guide documents the converter step for third-party OpenAPI plugins.

Constraint: OpenAPI Schema Object examples are array-shaped in JSON Schema/OpenAPI 3.1 while Parameter and Media Type examples remain named records
Rejected: Change typia's emended OpenApi.IJsonSchema examples to arrays | would discard labels before converters can choose a target dialect
Confidence: high
Scope-risk: moderate
Tested: pnpm format
Tested: pnpm build
Tested: node compiled OpenApiConverter downgradeSchema examples smoke test
Tested: pnpm run build (website)
Not-tested: Full test-utils runner; local ttsx project check timed out before executing filtered tests
Related: #1697
@samchon

samchon commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author

Self-review round 1 completed against the full PR diff (types, downgrade/upgrader converter paths, regression tests, and docs together).

Result: no follow-up changes found.

CI is green across build, experiments, test, website/deploy, tarballs, Socket, and spell-check.

@samchon samchon closed this Jul 5, 2026
OAS 3.0 only has the singular Schema Object example field, while OAS 3.1 and newer inherit JSON Schema's array-shaped examples keyword. The v3.0 downgrade path now strips typia's emended named examples instead of leaking a non-standard Schema Object field; v3.1 continues to emit the JSON Schema array form.

Constraint: OAS 3.0 Schema Object does not define examples; Parameter and Media Type examples remain named maps

Rejected: Keep examples?: any[] on OpenApiV3.IJsonSchema | still advertises a non-standard OAS 3.0 Schema Object field

Confidence: high

Scope-risk: narrow

Tested: pnpm format

Tested: pnpm build

Tested: node compiled OpenApiConverter downgradeSchema v3.0/v3.1 examples smoke test

Tested: pnpm --filter ./tests/test-utils start

Related: #1697
@samchon samchon reopened this Jul 5, 2026
JSON Schema examples are array-shaped in raw OpenAPI 3.1 and 3.2 Schema Objects, while typia's emended schema stores them as named records. These tests cover upgrade, downgrade, and document round-trip boundaries so schema examples cannot be confused with Media Type Object examples.

Constraint: OpenAPI 3.1/3.2 Schema Object examples use JSON Schema array semantics; Media Type examples remain named maps

Rejected: Only test top-level schema downgrade | would miss recursive property/item schemas and media-type map preservation

Confidence: high

Scope-risk: narrow

Tested: pnpm format

Tested: pnpm --filter ./tests/test-utils start

Tested: pnpm build

Tested: pnpm test

Tested: pnpm run build (website)

Related: #2001

Related: #1697
@samchon

samchon commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Self-review round 2 completed against the full PR diff after reopening and adding round-trip coverage.

Reviewed scope in one pass:

  • OpenAPI v3.0/v3.1/v3.2 raw Schema Object examples types
  • v3.0/v3.1 downgrade paths
  • v3.0/v3.1/v3.2 upgrade paths
  • schema-level examples vs Media Type Object examples separation
  • new regression tests and JSON schema guide wording

Result: no follow-up changes found.

Verification:

  • pnpm format
  • pnpm --filter ./tests/test-utils start
  • pnpm build
  • pnpm test
  • pnpm run build (website)
  • GitHub checks all green on 18c9877

@samchon samchon merged commit af51652 into master Jul 5, 2026
14 checks passed
@samchon samchon deleted the fix/openapi-schema-examples-type branch July 5, 2026 06:28
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