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

Enumeration values are not validated against the enum type

Open ranma42 opened this issue 8 years ago • 2 comments

In the following specification myenum is supposed to be an integer-valued enumeration, but its enum property is a list of mixed types. Unexpectedly, the validator does not report any error.

swagger: '2.0'
info:
  title: "bad api"
  version: "1.0.0"
host: localhost
schemes:
  - https
basePath: /path
paths:
  "/main":
    get:
      responses:
        200:
          description: "Main entry point"
definitions:
  myenum:
    type: integer
    enum:
      - not an integer
      - 2

ranma42 avatar Mar 23 '17 20:03 ranma42

Has this been resolved in latest version ?

kailashyogeshwar85 avatar Aug 16 '18 05:08 kailashyogeshwar85

Not yet, no. But a Pull Request is always welcome! Here is the file that would need to be edited.

JamesMessinger avatar Aug 27 '18 11:08 JamesMessinger