koumoul-dev / vue-openapi

OpenAPI viewer component for VueJS
MIT License
90 stars 19 forks source link

OpenAPI 3.0.0-RC0 (or later) compatibility #2

Closed MikeRalphson closed 7 years ago

MikeRalphson commented 7 years ago

I've been following your project with keen interest, as I am writing a converter (and validator) for Swagger 2.0 to OpenAPI 3.0.x.

I'm not sure if this is the right time to raise this issue, as you may not want to track Release Candidate versions of the specification, and even if so, the error may be in my validator or my reading of the OpenAPI Specification.

There is a hosted version of the validator tool here which has an API for validating OpenAPI 3.0.x specs.

The result of running against your spec is as reported here (first error only):

{
  "status": false,
  "message": "expected Object {\n  tags: Array [ 'pet' ],\n  summary: 'Finds Pets by status',\n  description: 'Multiple status values can be provided with comma separated strings',\n  operationId: 'findPetsByStatus',\n  produces: Array [ 'application/xml', 'application/json' ],\n  parameters: Array [\n    Object {\n      name: 'status',\n      in: 'query',\n      description: 'Status values that need to be considered for filter',\n      required: true,\n      type: 'array',\n      items: Object {\n        type: 'string',\n        enum: Array [ 'available', 'pending', 'sold' ],\n        default: 'available'\n      },\n      collectionFormat: 'multi'\n    }\n  ],\n  responses: Object {\n    '200': Object {\n      description: 'successful operation',\n      schema: Object {\n        type: 'array',\n        items: Object { $ref: '#/components/definitions/Pet' }\n      }\n    },\n    '400': Object { description: 'Invalid status value' }\n  },\n  security: Array [\n    Object { petstore_auth: Array [ 'write:pets', 'read:pets' ] }\n  ]\n} not to have property produces (false negative fail)",
  "context": "#/paths/~1pet~1findByStatus/get"
}

Thus the badge functionality currently returns

badge

I have tried comparing your v3 Petstore spec to my converted version, and other issues include formData parameters, which have been removed from the spec.

Keen to hear your thoughts.

nicolas-bonnel commented 7 years ago

Hi,

I had started converting the petstore spec to openapi 3.0 but had not finished. 30 min before you posted this issue, I discovered your project and used it to convert the petstore.json file to openapi 3.0 spec :).

The next version of the petstore.json file in the test folder will be this version converted with your tool.

The converted file now highlight cases that we do not handle, I will work on this and commit updates in few hours.

MikeRalphson commented 7 years ago

That's very cool. Please do let me know if anything in the converted sample doesn't look right to you.

MikeRalphson commented 7 years ago

Just to make you aware, spotted a (big) bug in the converter. parameter.type has been removed, all parameters now need a schema property if they are typed. Will let you know when examples updated.

nicolas-bonnel commented 7 years ago

Ok, saw the problem in path /store/order/{orderId}.

There is something I'm missing in the spec. Schema seems not mandatory, but parameters should have a default type (string ?).

I didn't see your bug because I added a default schema in preprocessing. I will keep this default schema with a string type until this get more precise in the spec.

MikeRalphson commented 7 years ago

I agree, I think the spec should explicitly define untyped parameters as accepting a string with no defined format restrictions. Defining a schema seems the only way to set a default value etc.

MikeRalphson commented 7 years ago

Converter/validator passing test suite again, as of v1.2.0.

nicolas-bonnel commented 7 years ago

Updated the example file using the last version of your converter.