IBM/openapi-validator

crash when type is an array

Closed this issue · 1 comments

To my understanding type as an array should be supported by OAS 3.1.0 as it is by current JSON Schema, but passing it generate a crash:

% cat /tmp/oas-ex.yaml
openapi: 3.1.0
info: {"description": foo, "title": t, "version": 0.0}
servers:
- description: d
paths:
  /a:
    get:
      operationId: a
      responses:
        200:
          description: a
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/A'

components:
  schemas:
    A:
      type: ['string', 'null']

% npx lint-openapi --debug -v -d /tmp/oas-ex.yaml
[Error] There was a problem with spectral.
Error running Nimma


[Error] Additional error details:

AggregateError: Error running Nimma
    at Scope.destroy (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/nimma/dist/legacy/cjs/runtime/scope.js:137:13)
    at Nimma.eval (eval at query (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/nimma/dist/legacy/cjs/core/index.js:66:71), <anonymous>:331:11)
    at Nimma.query (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/nimma/dist/legacy/cjs/core/index.js:68:71)
    at execute (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/@stoplight/spectral-core/dist/runner/runner.js:90:11)
    at Runner.run (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/@stoplight/spectral-core/dist/runner/runner.js:53:13)
    at Spectral.runWithResolved (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/@stoplight/spectral-core/dist/spectral.js:60:22)
    at async Spectral.run (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/@stoplight/spectral-core/dist/spectral.js:68:17)
    at async processInput (/Users/gaetano/prog/athenian/api-spec/tests/node_modules/ibm-openapi-validator/src/cli-validator/run-validator.js:259:25)

% npx lint-openapi --version
0.58.2

Hi @gaetano-guerriero. We do not yet support OpenAPI 3.1.0, which is why you are seeing this issue. It is an item on our roadmap but is not a high priority for us right now.