Skip to content

generate mandates all its elements #9

@mooseyboots

Description

@mooseyboots

while trying to get this library running against https://codeberg.org/swagger.v1.json, i found that generate mandates host basePath consumes produces, schemes. the codeberg/forgejo swagger has no host, so gethash errors.

so this:

  (let* ((host (gethash "host" openapi))
         (base-path (gethash "basePath" openapi))
         (consumes-media-types (gethash "consumes" openapi))
         (produces-media-types (gethash "produces" openapi))
         (schemes (or (gethash "schemes" openapi)
                      '("https")))

became:

  (let* ((host (or (gethash "host" openapi) ""))
         (base-path (gethash "basePath" openapi))
         (consumes-media-types (gethash "consumes" openapi))
         (produces-media-types (gethash "produces" openapi))
         (schemes (or (gethash "schemes" openapi)
                      '("https")))

i also found i had to add a similar or clause in security-schemas-from-hash-table:

 (make-instance 'security-schema
                                :name (gethash "name" schema)
                                :in (kebab-symbol-from-string (or (gethash "in" schema) "") :openapi2cl/core)

perhaps some other such elements are also not mandatory, i'm not sure as i've only tested the one spec so far.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions