Swagger Editor shows the “Schema error: should NOT have additional properties” error for a path parameter

断了今生、忘了曾经 提交于 2019-12-13 03:42:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!