Skip to content

[OpenAPI 3.1] Phase 2: engine reads 3.1 fields, keyword-based logic #950

Open
0 of 2 issues completed
Open

Description

@DrSatyr

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

Goal

The diff engine reads only 3.1 fields and picks its comparison logic by keyword, not by Java class.

Scope

One area per PR:

  • Types and null: compare the set of non-null types; "null" only goes through the null rule
  • Numeric bounds: effective bound (value + inclusive/exclusive)
  • Array/items: compare items for any schema that has it (not only ArraySchema)
  • allOf/anyOf/oneOf: flatten allOf/anyOf and compare oneOf members for any schema (not only ComposedSchema); flattening stays as today

Small helpers (SchemaTypes, NumericBounds) in utils keep this in one place. While this phase is in progress they accept both 3.0 and 3.1 shapes. Only existing verdict rules are used.

Done when

  • All existing tests green, no change in 3.0 verdicts
  • Paired fixtures for every area pass for 3.1→3.1
  • No reads of getType(), getNullable(), boolean getExclusiveMinimum/Maximum(), getExample() or instanceof on schema classes left in the engine

Related PR: #938

Activity

  1. added this to the 3.0.0 milestone on Nov 15, 2026
  2. added theissue type on Nov 15, 2026
  3. Inf1mum commented on Nov 16, 2026

    @Inf1mum

    Happy to take Area 1, Types and null.

    Plan: a small SchemaTypes helper in utils that reads the effective type set from both shapes (3.0 typed schemas keep getType(), 3.1 JsonSchema carries the set in getTypes()), and the type/nullable gates in SchemaDiff switched to compare that set instead of the raw getType() string — same approach as #938, generalized so every type read in the engine goes through the helper. "null" in the set goes through the existing nullable rule only, so 3.1 type: [string, "null"] behaves like 3.0 nullable: true. While the phase is in progress the helper accepts both shapes, so 3.0 verdicts stay byte-identical; boolean-sibling handling stays out (that belongs to the numeric-bounds area).

    Tests: new paired fixtures under core/src/test/resources/oas31/ (type change and nullable, the two rules in this area) plus a parameterized verdict test for 3.0→3.0 and 3.1→3.1, following the layout of the Phase 0 harness (#961) so the pieces drop together; where the harness already covers these rules, my branch carries the same fixture files so they merge cleanly. Existing suite stays green.

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