swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Field name "entries" in a schema causes swagger-editor to fail

Open jmmolina796 opened this issue 6 years ago • 1 comments

When I type the field name entries, I received a message saying: "Unable to render this definition".

paths:
  /pet:
    post:
      summary: "Add a new pet to the store"
      description: ""
      parameters:
      - in: "body"
        name: "body"
        schema:
          $ref: "#/definitions/Pet"
      responses:
        "405":
          description: "Invalid input"
definitions:
  Pet:
    type: "object"
    properties:
      id:
        type: "integer"
      entries:
        type: "array"
        items:
          type: "string"
Screen Shot 2020-05-18 at 17 14 21

I need to write entries as a field since my API requires this name.

If I change entries to entry, it works as expected.

paths:
  /pet:
    post:
      summary: "Add a new pet to the store"
      description: ""
      parameters:
      - in: "body"
        name: "body"
        schema:
          $ref: "#/definitions/Pet"
      responses:
        "405":
          description: "Invalid input"
definitions:
  Pet:
    type: "object"
    properties:
      id:
        type: "integer"
      entry:
        type: "array"
        items:
          type: "string"

Can someone help me with this problem, why it fails when I use entries as a field name?

jmmolina796 avatar May 18 '20 22:05 jmmolina796

Thanks for the report! This issue is tracked in https://github.com/swagger-api/swagger-ui/issues/6016 so I'll close this one as a duplicate.

As a workaround please use editor v. 3.8.2, you can download it from the Releases page.

hkosova avatar May 19 '20 05:05 hkosova