readmeio / oas

Comprehensive tooling for working with OpenAPI definitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation error with numeric default

thephez opened this issue · comments

Issue

I am unable to get a numerical parameter to be recognized as valid if it is assigning a default. Using Number or Integer:<type> results in the following error message:

Error validating Swagger!

      ✖  expected 'number' to be 'string'

How to duplicate

Example body parameter that causes this:

    * parameters:
    *   - (body) id=1* {Integer:int32} Request ID

The example shown on http://openap.is/ returns the same error.:

    * parameters:
    *   - (query) limit=5* {Integer:int32} Amount returned

Running the displayed oas generate json output through an online validator confirms that it is a valid OpenAPI document, so it appears this is a validation issue in oas or one of its dependencies.

Okay, fixed! I believe the validator we used may have changed, since this all used to work and many other validators are fine with the default being a string! Thanks for posting it :)

To update, run:

$ npm install oas -g

And it should all work!

👍 Thanks, that resolved the issue