Skip to content

[OpenAPI 3.1] Phase 1: 3.0→3.1 converter #949

Description

@DrSatyr

Part of the OpenAPI 3.1 plan: #942 (Stage 1, Phase 1)

Goal

A converter that turns Swagger 2.0 / OpenAPI 3.0 objects into the 3.1 form. Not wired in yet.

Scope

  • New package org.openapitools.openapidiff.core.normalize, called once per spec
  • Walks every schema: components, parameters, headers, request/response bodies, callbacks, and nested (properties, items, additionalProperties, allOf/anyOf/oneOf, not)
  • Rules: type → types; nullable: true → "null" in types (not when there is no type); boolean exclusiveMinimum/Maximum → numeric; example → examples; typed classes → JsonSchema
  • Works on a copy (JSON round-trip with swagger-core's mapper), so the input objects are never modified

Done when

  • Converted 3.0 == natively parsed 3.1 (compared as serialized JSON) for all paired fixtures
  • Swagger 2.0 fixture converts correctly
  • Copy test: input objects are unchanged after conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions