swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Undefined but required properties do not fail the validation

Open mischac opened this issue 7 years ago • 2 comments

Description

The validation does not check whether a required property is actually part of the definition: A message like Schema properties specified as 'required' must be defined is not created for the validation

Swagger-codegen version

2.2.2

Swagger declaration file content or url

In below the version is required but not a property:

  Sample:
    required:
      - name
      - version
    properties:
      name:
        type: string
Command line used for generation
Steps to reproduce
Related issues
Suggest a Fix

mischac avatar May 24 '17 08:05 mischac

Hi @mischac is this still an issue? I see a closed PR in other project. Did That fixed your issue?

gracekarina avatar Sep 15 '18 17:09 gracekarina

Required properties that do not have a schema defined are a valid use case. In that case the required property must only be present, and any value is accepted.

spacether avatar Sep 16 '22 20:09 spacether