Skip to content

feat(oas32): add initial OAS 3.2.0 support#4153

Draft
robert-hebel-sb wants to merge 10 commits intomasterfrom
feat/add-oas-32-support
Draft

feat(oas32): add initial OAS 3.2.0 support#4153
robert-hebel-sb wants to merge 10 commits intomasterfrom
feat/add-oas-32-support

Conversation

@robert-hebel-sb
Copy link
Contributor

Description

This PR adds support for OpenAPI 3.2.0 specification to swagger-js. The implementation includes:

  • New OpenAPI 3.2 dereference strategy using ApiDOM
  • Parser support for both JSON and YAML OpenAPI 3.2 documents
  • Integration with the main entry point for automatic version detection
  • Documentation updates for installation optimization
  • Webpack configuration adjustments for increased bundle size

Motivation and Context

OpenAPI 3.2.0 is the latest version of the OpenAPI Specification and includes important updates such as:

  • New features and clarifications

This change enables swagger-js to parse, resolve references, and execute operations defined in OpenAPI 3.2 specifications, maintaining compatibility with existing versions (2.0, 3.0.x, 3.1.x).

How Has This Been Tested?

  • Added comprehensive unit tests for OpenAPI 3.2 parser (JSON and YAML)
  • Added normalization and macro tests for the OpenAPI 3.2 strategy
  • Added dereference strategy tests covering various $ref scenarios
  • All existing tests pass, ensuring backward compatibility
  • Tested with sample OpenAPI 3.2 specifications

Screenshots (if appropriate):

N/A

Types of changes

  • No code changes (changes to documentation, CI, metadata, etc)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

robert-hebel-sb and others added 10 commits January 23, 2026 12:34
Fix dereference strategy to extend OpenAPI3_2DereferenceStrategy instead
of OpenAPI3_1DereferenceStrategy, enabling proper matching of OpenAPI 3.2
files. Update tests to use correct API interface and reflect that isOpenAPI3
now includes 3.2 support. Adjust webpack bundle size limits to accommodate
new ApiDOM dependencies.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add OpenAPI 3.2 predicate function and integrate 3.2 resolution strategies,
parsers, and dereference strategies into the main Swagger client. Update
documentation to reflect 3.2 support and add necessary ApiDOM dependencies.

Changes:
- Add isOpenAPI32() predicate and update isOpenAPI3() to include 3.2
- Register openapi-3-2-apidom strategy in resolve and resolveSubtree
- Add OpenAPI 3.2 JSON/YAML parsers and dereference strategy to apidom exports
- Update CLAUDE.md and README.md with 3.2 compatibility information
- Add @swagger-api/apidom-ns-openapi-3-2 dependency

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add full implementation of OpenAPI 3.2 swagger-client dereference
strategy with feature parity to OAS 3.1, including:

- Custom error handling with SchemaRefError
- Path conversion and root cause extraction utilities
- Complete visitor implementations for:
  - Reference resolution ($ref)
  - Schema Object dereferencing with $id/$anchor support
  - Path Item Object dereferencing
  - allOf merging with enum handling
  - Parameter and model property macros
  - Example Object external value resolution
- Circular reference detection and handling
- Meta patches support ($$ref)
- Comprehensive error collection and reporting

Update ESLint configuration to ignore OpenAPI 3.2 apidom-reference
imports matching the pattern used for OAS 3.1.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add test suite for OpenAPI 3.2.0 dereference strategies covering:
- Schema Object ($ref resolution, circular references, internal/external refs)
- Parameter Object (components, path-level, operation-level)
- Path Item Object (paths field, components/pathItems)
- Response Object (components/responses)
- Request Body Object (with allOf merging)
- Reference Object (mixed references across locations)
- Security Scheme Object (components/securitySchemes)

Test structure:
- 7 test suites with 15 passing tests
- 26+ fixture files (root.json and dereferenced.json pairs)
- Jest setup utility for OpenAPI 3.2 parsers and resolvers

All tests follow patterns established in OpenAPI 3.1 test suite for
consistency and maintainability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…tegy

Add comprehensive test coverage for OpenAPI 3.2.0 resolver strategy:

Normalize tests (9 tests):
- Header Object examples normalization
- Parameter Object examples normalization
- Operation.id fields normalization
- Parameter Objects from path to operation level
- Security Requirements Objects normalization
- Server Objects normalization
- Element compatibility checks
- Idempotent normalization verification
- POJO adapter caching

Additional main tests (11 new tests):
- parameterMacro option with Operation and Parameter Objects
- parameterMacro with Parameter Object only (no operation)
- parameterMacro error handling
- modelPropertyMacro option with Schema Object properties
- modelPropertyMacro error handling
- Combined macros with allOf schema merging

New fixtures:
- circular-structures.json
- parameter-macro.json
- parameter-macro-no-operation.json
- model-property-macro.json
- model-property-macro-error.json
- ref-all-of-macros.json
- 6 normalize fixtures

Test results: 29 tests passing (20 main + 9 normalize)
All tests follow patterns established in OpenAPI 3.1 test suite.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive test coverage for OpenAPI 3.2.0 parser plugins:

OpenAPI JSON 3.2 Parser Tests (12 tests):
- File extension detection (.json)
- Media type validation (proper/improper)
- Unknown extension handling
- No extension handling
- Buffer and string data parsing
- OpenAPI 3.2.0 detection from file data
- Non-OpenAPI data coercion
- Empty file handling
- Source map support validation
- Parse result verification

OpenAPI YAML 3.2 Parser Tests (14 tests):
- File extension detection (.yaml and .yml)
- Media type validation (proper/improper)
- Unknown extension handling
- No extension handling
- Buffer and string data parsing
- OpenAPI 3.2.0 detection from file data
- Non-OpenAPI data coercion
- Empty file handling
- Source map support validation
- Parse result verification

Test fixtures:
- sample-api.json (comprehensive OpenAPI 3.2.0 spec)
- sample-api.yaml (comprehensive OpenAPI 3.2.0 spec)

Test results: 26 tests passing (12 JSON + 14 YAML)
All tests follow patterns from OpenAPI 3.1 parser test suite.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Increases maxEntrypointSize from 570000 to 590000 bytes to accommodate
the additional code required for OpenAPI 3.2 functionality.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
# Conflicts:
#	config/webpack/browser.config.babel.js
#	package-lock.json
#	package.json
Updates @swagger-api/apidom-* packages from 1.2.2 to 1.4.0 to support
OpenAPI 3.2 functionality.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updates both package.json and installation.md to include OpenAPI 3.0,
3.1, and 3.2 namespace packages and parser adapters in the optional
dependencies override configuration for faster installation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robert-hebel-sb robert-hebel-sb added cat: documentation type: enhancement javascript Pull requests that update Javascript code labels Feb 11, 2026
@robert-hebel-sb robert-hebel-sb marked this pull request as draft February 11, 2026 08:19
@robert-hebel-sb robert-hebel-sb changed the title feat(oas32): add initial oas32 support feat(oas32): add initial OAS 3.2.0 support Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat: documentation javascript Pull requests that update Javascript code type: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant