Skip to content

feat: OpenAPI 3.1/3.2 support, Java 17 upgrade, and configurable generation options - #7

Open
rafael-goterris wants to merge 11 commits into
developfrom
feature/openapi3132
Open

feat: OpenAPI 3.1/3.2 support, Java 17 upgrade, and configurable generation options#7
rafael-goterris wants to merge 11 commits into
developfrom
feature/openapi3132

Conversation

@rafael-goterris

Copy link
Copy Markdown

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe): Runtime/toolchain upgrade — Java 17 & Spring Boot 3

What is the current behavior?

The project targets Java 11 / Spring Boot 2.5.2 and uses an older swagger-parser (2.0.24) that only parses OpenAPI 3.0.x reliably. SoapUI project generation offers no configuration options — every request produces the same full project.

Issue Number: N/A

What is the new behavior?

  • OpenAPI 3.1 & 3.2 support. Upgraded swagger-parser to 2.1.42 for native 3.1 parsing (JSON Schema 2020-12, type: [string, null], component-level examples), and added a project-level normalization layer (SerializedDataUtils.normalizeOpenAPI32Content) that maps 3.2-only constructs (querystring params, query operation, $self, additionalOperations, components.mediaTypes) onto a parseable 3.1 form. Version is auto-detected from the openapi field.
  • Java 17 / Spring Boot 3.3.0 upgrade. Bumped the parent to Spring Boot 3.3.0, migrated javax.*jakarta.*, switched springdoc to springdoc-openapi-starter-webmvc-ui 2.6.0, pinned the compiler plugin to Java 17, and updated the Dockerfile base image to openjdk:17-jdk.
  • 7 optional generation options (openapi2postman feature parity). New optional options object on the request: readOnly, serverPattern, minimalEndpoints, microcksHeaders, generateOneOfAnyOf, examples, and validateSchema. All options are backward-compatible — requests without an options field behave exactly as before.
  • Comprehensive test suite. Added ~15 OpenAPI version-support tests plus integration tests covering end-to-end generation, HTTP method handling, parameter/schema handling, edge cases, and the new feature flags.
  • Documentation. Added OPENAPI_VERSIONS.md and expanded the README.md (Java 17, 3.1/3.2 support, advanced-options reference) and api.yaml.
  • Version bump to 2.0.0 (breaking toolchain change).

Other information

  • The 2.0.0 bump reflects the breaking runtime requirement: Java 17 is now required to build and run the service.
  • OpenAPI 3.2.0 support is delivered through a compatibility normalization layer rather than native parser support, since swagger-parser does not yet fully support 3.2; this keeps generation working today and can be simplified once upstream parser support lands.

Marco A. Sanz and others added 11 commits April 27, 2026 17:42
- Update java.version from 11 to 17
- Upgrade Spring Boot parent from 2.5.2 to 3.3.0 for Java 17+ support
- Add explicit maven-compiler-plugin v3.11.0 configuration
- Update springdoc from 1.5.6 to 2.0.2
- Change springdoc artifact to springdoc-openapi-starter-webmvc-ui
- Migrate validation imports from javax.validation to jakarta.validation

This enables full Java 17+ compatibility and ensures the project builds
successfully on Java 17, 18, 19, 20, and 21+.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Implement 7 optional feature flags to match openapi2postman functionality:
- readOnly: exclude write operations (POST, PUT, PATCH, DELETE)
- serverPattern: select server by URL pattern matching
- minimalEndpoints: generate only Success test case per endpoint
- microcksHeaders: add X-Microcks-Response-Name headers
- generateOneOfAnyOf: resolve composed schemas (oneOf/anyOf/allOf)
- examples: custom default values for generated examples
- validateSchema: add Groovy script validation test step

All features are optional and backward-compatible. Requests without the
"options" field behave identically to the current implementation.

Architecture: New DTO chain (SoapUIProjectOptions → ExampleValues → ExampleSet)
keeps the constructor signature lean while supporting extensibility.

Comprehensive test coverage:
- 10 unit tests (SoapUIProjectFeatureTest)
- 9 integration tests (SoapUIProjectControllerFeatureTest)
- 3 DTO tests (SoapUIProjectOptionsTest)

All 23 tests passing.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Upgrade swagger-parser from 2.0.24 to 2.1.19 to enable full support for
OpenAPI 3.1.x specifications, including JSON Schema 2020-12, nullable types,
and enhanced examples handling.

Features:
- OpenAPI 3.0.x: Fully supported (3.0.0-3.0.3)
- OpenAPI 3.1.x: Fully supported with JSON Schema 2020-12
- OpenAPI 3.2.x: Forward compatibility ready (not yet released)

Comprehensive test coverage: 15 new tests across 5 test groups:
- OpenAPI 3.0.x parsing (2 tests)
- OpenAPI 3.1.x parsing (5 tests)
- Version-agnostic feature support (3 tests)
- Complex schema handling (3 tests)
- Forward compatibility (2 tests)

All features (readOnly, serverPattern, minimalEndpoints, microcksHeaders,
generateOneOfAnyOf, examples, validateSchema) work seamlessly across all
supported OpenAPI versions.

Documentation: Added OPENAPI_VERSIONS.md with:
- Version support matrix
- Migration guide from 3.0 to 3.1
- Dependency information
- Best practices and troubleshooting

Total tests passing: 38 (23 feature tests + 15 version tests)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Create 5 new integration test classes with 50+ test methods covering all
functionality of the openapi2soapui tool. Tests validate end-to-end project
generation, HTTP method handling, parameter processing, schema handling,
and edge cases.

Test Coverage (50 new tests):
1. EndToEndGenerationTest (9 tests)
   - Simple API generation (minimal specs)
   - Complex API generation (nested bodies, multiple servers, content types)
   - Feature integration tests (readOnly, custom examples, multiple features)

2. HTTPMethodHandlingTest (10 tests)
   - Standard methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
   - Multiple methods on same path
   - Method filtering with readOnly option

3. ParameterHandlingTest (9 tests)
   - Path parameters (single, multiple)
   - Query parameters (single, multiple, required/optional)
   - Header parameters
   - Mixed parameter types
   - Parameter data types (string, integer, number, boolean, date, array)

4. SchemaHandlingTest (11 tests)
   - Basic data types (string, numeric, boolean)
   - Complex schemas (nested objects, arrays, allOf composition)
   - Schema constraints (enum, min/max)
   - Format handling (date, date-time, email)

5. EdgeCaseTest (11 tests)
   - Minimal/empty specs
   - Special characters and Unicode
   - Large specs with many endpoints
   - Deeply nested schemas
   - Various HTTP response codes
   - Options handling (null/empty)
   - Path variations and complex structures
   - Multiple content types

All 88 tests passing (38 + 50 new):
- 10 feature tests (readOnly, serverPattern, minimalEndpoints, etc.)
- 9 controller integration tests
- 3 DTO option tests
- 15 OpenAPI version support tests
- 50 new comprehensive integration tests
- 1 Spring Boot application test

Total test execution: ~7 seconds
Zero failures, zero errors

Tests cover:
✅ OpenAPI 3.0.x and 3.1.x specs
✅ CRUD operations and HTTP verbs
✅ Complex nested data structures
✅ Multiple servers and endpoints
✅ Request/response handling
✅ Parameter validation
✅ Schema composition
✅ Edge cases and error conditions
✅ Feature combinations
✅ Large and complex specs

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…options

Documentation updates:
- Updated Java version: JDK 11 → JDK 17
- Updated Spring Boot: 2 → 3.3.0
- Updated Tomcat: 9 → 10
- Updated Swagger Parser: 2.1.19+ with JSON Schema 2020-12 support
- Added OpenAPI version support section (3.0.x, 3.1.x, 3.2.x)

New sections:
- Advanced Generation Options: detailed documentation for 7 feature flags
  - readOnly: exclude write operations
  - serverPattern: server selection by URL pattern
  - minimalEndpoints: minimal test case generation
  - microcksHeaders: Microcks integration headers
  - generateOneOfAnyOf: composed schema resolution
  - examples: custom default values
  - validateSchema: response validation steps

- OpenAPI Version Support: compatibility matrix and feature comparison
- Testing: reference to 88 comprehensive tests with details
- Links to OPENAPI_VERSIONS.md documentation

All options documented with examples and descriptions.
Full backward compatibility maintained.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Upgrade runtime to Java 17 (Dockerfile openjdk base)
- Bump swagger-parser from 2.1.19 to 2.1.41
- Add OpenAPI 3.2 normalization layer in SerializedDataUtils
  * Normalizes 3.2 specs to 3.1-compatible structure before parsing
  * Transforms querystring parameter location to query
  * Remaps 3.2-specific fields to extension-safe keys
- Improve SoapUI generation resilience
  * Support querystring parameter handling
  * Centralize and simplify readOnly HTTP method filtering
  * Gracefully skip unsupported HTTP methods with logging
- Convert OpenAPI 3.2 tests from placeholder to concrete behavior
  * Add real 3.2 parsing and generation tests
  * Add querystring parameter compatibility test
- Update documentation to reflect official 3.2 support strategy
  * OPENAPI_VERSIONS.md: 3.2 now marked as officially supported
  * README.md: Updated compatibility matrix and feature table

Impact: OpenAPI 3.2 specs can now be parsed and reliably converted to SoapUI projects via normalization layer, safer handling of edge-case parameter/method types, and clearer product messaging.

Closes: OpenAPI 3.2 support feature
Co-authored-by: Rafael Goterris Perales <rafael.goterris@cloudappi.net>
- pom.xml: bump openapi2soapui to 2.0.0 and springdoc to 2.6.0 (Spring Boot 3.3 compatible)
- SoapUIProject.java: extract configureResourceMethod / configureMethodRequest helpers
  to reduce cognitive complexity (S3776) on setResourceMethods and setMethodsRequests
- SerializedDataUtils.java: use pattern matching for instanceof (S6201)
- OpenAPIVersionSupportTest.java: replace YAML string concatenations with text blocks (S6126)
- Rename configureResourceMethod -> setResourceMethod
- Rename configureMethodRequest -> setMethodRequest
- Rename applyRequestBodyContent -> setRequestBodyContent
- Add Javadoc to each new private helper to match the rest of the class
OpenAPI 3.2 Compatibility Layer + Java 17 Alignment and Parser Upgrade
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants