Skip to content

OpenAPI 3.1 compatibility: "examples" property not allowed / "type" property as an array not allowed #431

@Tithugues

Description

@Tithugues

Describe the bug
From OpenAPI 3.1, the example property is deprecated and examples is preferred and type property can be a string, but also an array of strings.

The examples property and the type as an array seem not to be supported.

To Reproduce

  1. Create a YAML file in a project
  2. Copy the following lines in the file:
openapi: '3.1.0'
info:
  version: '0.0.1'
  title: 'My API'
paths:
  /my/route:
    get:
      operationId: MyRoute
      responses:
        200:
          description: 'Successful response.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  a_property:
                    type: ['string', 'null']
                    examples:
                      - null
                      - "Hello world!"
  1. See errors

Expected behavior
I would expect examples and type as an array to be allowed in the editor part.

Screenshots
Editor complains about those 2 properties:
image

On the other hand, the preview seems to "understand" the syntax:
image

Stack trace
No exception.

Desktop (please complete the following information):

  • Zalando OpenAPI Editor version: 1.3.0
  • IDEA version: PhpStorm 2024.1.1 (Build #PS-241.15989.102, built on April 23, 2024)
  • Java version: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
  • Operating System & version: Ubuntu 22.04

Additional context
Swagger editor (https://editor-next.swagger.io) does not complain about this YAML file.


Am I wrong anywhere?
Is the OpenAPI 3.1 not supported? If so, is it expected to be supported?

Thank you! 🙏

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions