Skip to content

[3.1] Failed to unmarshal unevaluatedProperties: false (boolean form) #844

@pedrosmr

Description

@pedrosmr

Describe the bug
oasdiff fails to load an OpenAPI 3.1 spec that uses unevaluatedProperties: false (boolean form). JSON Schema 2020-12 allows unevaluatedProperties to be either a boolean or a schema object, but the parser only accepts the schema object form.

To Reproduce

  1. Command: oasdiff breaking base.yaml revision.yaml
  2. Spec (minimal reproduction):
openapi: 3.1.0
info:
  title: Test
  version: "1.0"
paths:
  /test:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              unevaluatedProperties: false
              allOf:
                - $ref: '#/components/schemas/Base'
      responses:
        '200':
          description: OK
components:
  schemas:
    Base:
      type: object
      properties:
        name:
          type: string
  1. Output:
Error: failed to load base spec from "base.yaml": failed to unmarshal data: json error: invalid character 'o' looking for beginning of value, yaml error: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal bool into field Schema.unevaluatedProperties of type openapi3.Schema

Expected behavior
unevaluatedProperties: false should be accepted as valid JSON Schema 2020-12. Per the spec, unevaluatedProperties can be a boolean or a schema object — false is equivalent to {"not": {}}.

Desktop (please complete the following information):

  • OS: Linux (amd64, Drone CI container)
  • oasdiff version: v2.2.0-openapi31.beta.3 (installed via install.sh)

Additional context
The unevaluatedProperties boolean form is commonly used with allOf composition to prevent extra properties from slipping through unvalidated. Our OpenAPI 3.1 specs use this pattern in three places. This blocks us from testing the beta in CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions