Apicurio / apicurio-studio

Open Source API Design
https://www.apicur.io/studio/
Apache License 2.0
991 stars 502 forks source link

Validation Issues with Swagger Editor #348

Open sherl0cks opened 6 years ago

sherl0cks commented 6 years ago

I exported my API which has no validation errors in apicurio and then imported to swagger editor, where I got a looooong list of validation errors:

Schema error at paths['/opportunities'].post.responses['201']
should have required property 'description'
missingProperty: description
Jump to line 23
Schema error at paths['/opportunities'].post.responses['201']
should have required property '$ref'
missingProperty: $ref
Jump to line 23
Schema error at paths['/opportunities'].post.responses['201']
should match exactly one schema in oneOf
Jump to line 23
Schema error at paths['/opportunities'].post.responses['400']
should have required property 'description'
missingProperty: description
Jump to line 28
Schema error at paths['/opportunities'].post.responses['400']
should have required property '$ref'
missingProperty: $ref
Jump to line 28
Schema error at paths['/opportunities'].post.responses['400']
should match exactly one schema in oneOf
Jump to line 28
Schema error at paths['/opportunities'].post.responses['500']
should have required property 'description'
missingProperty: description
Jump to line 33
Schema error at paths['/opportunities'].post.responses['500']
should have required property '$ref'
missingProperty: $ref
Jump to line 33
Schema error at paths['/opportunities'].post.responses['500']
should match exactly one schema in oneOf
Jump to line 33
Schema error at paths['/opportunities/{id}'].post.responses['200']
should have required property 'description'
missingProperty: description
Jump to line 47
Schema error at paths['/opportunities/{id}'].post.responses['200']
should have required property '$ref'
missingProperty: $ref
Jump to line 47
Schema error at paths['/opportunities/{id}'].post.responses['200']
should match exactly one schema in oneOf
Jump to line 47
Schema error at paths['/opportunities/{id}'].post.responses['400']
should have required property 'description'
missingProperty: description
Jump to line 52
Schema error at paths['/opportunities/{id}'].post.responses['400']
should have required property '$ref'
missingProperty: $ref
Jump to line 52
Schema error at paths['/opportunities/{id}'].post.responses['400']
should match exactly one schema in oneOf
Jump to line 52
Schema error at paths['/opportunities/{id}'].post.responses['404']
should have required property 'description'
missingProperty: description
Jump to line 57
Schema error at paths['/opportunities/{id}'].post.responses['404']
should have required property '$ref'
missingProperty: $ref
Jump to line 57
Schema error at paths['/opportunities/{id}'].post.responses['404']
should match exactly one schema in oneOf
Jump to line 57
Schema error at paths['/opportunities/{id}'].post.responses['500']
should have required property 'description'
missingProperty: description
Jump to line 62
Schema error at paths['/opportunities/{id}'].post.responses['500']
should have required property '$ref'
missingProperty: $ref
Jump to line 62
Schema error at paths['/opportunities/{id}'].post.responses['500']
should match exactly one schema in oneOf
Jump to line 62
Schema error at components.schemas['CommandProcessingResponse']
should have required property '$ref'
missingProperty: $ref
Jump to line 75
Schema error at components.schemas['CommandProcessingResponse']
should match exactly one schema in oneOf
Jump to line 75
Schema error at components.schemas['CommandProcessingResponse'].required
should NOT have less than 1 items
limit: 1
Jump to line 76
sherl0cks commented 6 years ago

This diff resolved the validation issues in swagger UI and import of this doc into apicurio worked as expected, apart from #349

EricWittmann commented 6 years ago

Clearly the validation rules in Swagger UI are different than what has been implemented in Apicurio. And those differences will only increase over time, as I have more bandwidth to extend the set of validation rules in Apicurio.

I'll have to go through each of these (mostly dupes it seems) but at first glance it definitely seems like at least the "response description required property" validation rule is missing from Apicurio. I thought that was made optional in 3.0.x of the spec (which is why I didn't implement it) but now that I've checked the specification again it seems I was wrong! :) So I'll open a separate issue for that and take a look at the rest of these later.

EricWittmann commented 6 years ago

https://github.com/Apicurio/oai-ts-core/issues/14

sherl0cks commented 6 years ago

Just hit some other validation oddities, should I open those here or in https://github.com/Apicurio/oai-ts-core/issues/?

EricWittmann commented 6 years ago

Yeah that'd be great!