问题
I am creating an OpenAPI (Swagger) definition and checking its validity in http://editor.swagger.io. For some reason, Swagger Editor shows this error:
Schema error at paths['/some-endpoint/{id}/name-and-address'].get.parameters[0]
should NOT have additional properties
additionalProperty: type, allowEmptyValue, enum, name, in, description, required
Jump to line 142
Below is my YAML file:
paths:
'/some-endpoint/{id}/name-and-address':
get:
tags:
- InvolvedParty
summary: Retrieve basic information about...
operationId: getNameAndAddressUsingGET
produces:
- '*/*'
parameters:
- name: id
in: path
description: The unique identification
required: true
type: string
allowEmptyValue: false
enum:
- '@coderange[1'
- 'infinity]'
responses:
'200':
description: Success
I haven't added any other properties as the error message implies. How to fix this error?
回答1:
Remove allowEmptyValue - it's only used with query and formData parameters, but not with path parameters.
来源:https://stackoverflow.com/questions/50562971/swagger-editor-shows-the-schema-error-should-not-have-additional-properties-e