Skip to content

Semantic error at paths is not detected by validator #176

@lenchvolodymyr

Description

@lenchvolodymyr

The swagger-parser doesn't validate semantic error when path parameter has invalid type.

This schema is invalid according to swagger-editor

openapi: 3.0.3
info:
  title: ''
  version: '1.0'
paths:
  '/items/{id}':
    get:
      parameters:
        - name: id
          in: query
          required: true
          schema:
            type: object
            nullable: false
      responses:
        '200':
          description: ''
components: {}

It shows the following error:

Semantic error at paths./items/{id}
Declared path parameter "id" needs to be defined as a path parameter at either the path or operation level

But swagger-parser doesn't throw any errors when validating the schema.

const SwaggerParser = require('swagger-parser');

SwaggerParser.validate(script, {}, (err, api) => {...});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions