swagger editor shows validation errors
schemacs opened this issue · comments
Lele Long commented
make build
$ make build
Building mattermost openapi yaml for v4
v4/html/static/mattermost-openapi-v4.yaml is valid
Complete
But after I copy v4/html/static/mattermost-openapi-v4.yaml to https://editor.swagger.io , the errors are:
Semantic error at paths./posts/{post_id}/patch.put.parameters.1.schema.properties.file_ids
Schemas with 'type: array', require a sibling 'items: ' field
Jump to line 6345
Structural error at paths./system/ping.get.responses.500
should NOT have additional properties
additionalProperty: schema
Jump to line 7363
Structural error at paths./brand/image.get.responses.404
should NOT have additional properties
additionalProperty: description
Jump to line 9080
Structural error at paths./brand/image.delete.responses.404
should NOT have additional properties
additionalProperty: description
Jump to line 9165
The fix may be this patch?
--- a/v4/source/posts.yaml
+++ b/v4/source/posts.yaml
@@ -244,6 +244,8 @@
file_ids:
description: The list of files attached to this post
type: array
+ items:
+ type: string
has_reactions:
description: Set to `true` if the post has reactions to it
type: boolean
+++ b/v4/source/system.yaml
@@ -15,10 +15,6 @@
$ref: "#/definitions/StatusOK"
'500':
$ref: '#/responses/InternalServerError'
- schema:
- type: object
- items:
- type: string
x-code-samples:
- lang: 'Go'
source: |
--- a/v4/source/brand.yaml
+++ b/v4/source/brand.yaml
@@ -13,7 +13,6 @@
schema:
type: string
'404':
- description: No brand image uploaded
$ref: '#/responses/NotFound'
'501':
$ref: '#/responses/NotImplemented'
@@ -98,7 +97,6 @@
'403':
$ref: '#/responses/Forbidden'
'404':
- description: No brand image uploaded
$ref: '#/responses/NotFound'
x-code-samples:
- lang: 'Go'
I wonder if swagger cli validation fails or the backend for https://editor.swagger.io is not upgraded to the latest.
Trevor Hartman commented
I hit this today too. It prevented me from generating a swagger client (though I was able to workaround).
Ben Schumacher commented
I created a ticket in our internal ticket system JIRA to keep track of this: https://mattermost.atlassian.net/browse/MM-20015
Ben Schumacher commented
Fixed with #488