Skip to content

Validation Parameters, vague errors that have regressed ( I believe ) #1511

@ponelat

Description

@ponelat
Q A
Bug or feature request? Bug ( regression )
Which Swagger/OpenAPI version? 2.0
Which Swagger-Editor version? swaggerEditor/Ui: "3.1.9/g95b3f38a-dirty" / version: "3.2.2" / gitRevision: "g774a066"
How did you install Swagger-Editor? Custom + Using Online version
Which broswer & version? Chrome/59
Which operating system? Linux Mint 18

Demonstration API definition

swagger: '2.0'
info:
  version: '1'
  title: oneOf validation fail
  description: ok

paths:
  /models/{name}:
    get:
      summary: Extra `example` field in parameter
      description: ok
      parameters: 
      - in: path
        name: name
        type: string
        required: true
        example: ok
      responses:
        200:
          description: Ok

Expected Behavior

Validation should show that the "example" key is not allowed in "path" parameters.

Current Behavior

Two validation errors occur...

should NOT have additional properties
additionalProperty: type, example, in, name, required
Jump to line 13
Schema error at paths['/models/{name}'].get.parameters[0].in
should be equal to one of the allowed values
allowedValues: body, header, formData, query
Jump to line 13

Possible Solution

Hack the structural validation lib, to better handle oneOf cases?
Ie: in: path then enforce validation for path items.
Or catch the strings ( this was done before and has regressed ) and transform the error message.
And perhaps lastly, add custom validation to the cases where oneOf appear, and remove the bad structural messages.

Context ( as a user )

Frustration on how to fix the spec, given the vague somewhat incorrect validation messages.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions