jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 42 forks source link

Having a description in a path triggers perl error #196

Closed reinierk closed 3 years ago

reinierk commented 3 years ago

I have a swagger.io validated openapi 3.0.3 schema that has a description field for each path. This triggers a Perl error on the last path having such a description. Deleting that description makes the error trigger on a previous path (with description) OpenAPI version: 3.40 error: Can't use string ("Read NmsAPI log files") as a HASH ref while "strict refs" in use at lib/Mojolicious/Plugin/OpenAPI.pm line 112 below the path of the schema

  '/system/logs':
    description: "Read NmsAPI log files"
    get:
      operationId: GetSystemLogs
      description: "Get the most recent <limit> lines of the audit log. Default=20."
      parameters:
        - name: limit
          description: limit of log lines to show.
          required: false
          in: query
          schema:
            type: integer
            default: 20
        - name: f
          description: Filter as Regular Expression.
          required: false
          in: query
          schema:
            type: string
### continues with responses etc ###
jhthorsen commented 3 years ago

I wonder if this is fixed in #160. Could you please try out that branch? You also need the latest version of JSON::Validator.

reinierk commented 3 years ago

Tried it today, but now Swagger.io editor rejects the document! Might have been a validation error in swagger.io. Both your code AND swagger.io throw an error now. Sorry for the inconvenience...