openapi2cl
openapi2cl copied to clipboard
`generate` mandates all its elements
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.