You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot generate Markdown file from properly validated API definition file:
$ oad --verbose gen-docs -s docs/api/swagger.yaml -d api.md
[08/07/23 12:35:24] DEBUG Running in --verbose mode main.py:27
DEBUG Reading from file docs/api/swagger.yaml source.py:77
Traceback (most recent call last):
File "<redacted_path>/.venv/bin/oad", line 8, in <module>
sys.exit(main())
^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/openapidocs/commands/docs.py", line 51, in generate_documents_command
generate_document(source, destination, style)
File "<redacted_path>/.venv/lib/python3.11/site-packages/openapidocs/mk/generate.py", line 14, in generate_document
html = handler.write()
^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/openapidocs/mk/v3/__init__.py", line 427, in write
operations=self.get_operations(),
^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/openapidocs/mk/v3/__init__.py", line 181, in get_operations
tag = self.get_tag(path_item) or ""
^^^^^^^^^^^^^^^^^^^^^^^
File "<redacted_path>/.venv/lib/python3.11/site-packages/openapidocs/mk/v3/__init__.py", line 219, in get_tag
tags = operation.get("tags")
^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get'
The text was updated successfully, but these errors were encountered:
volphy
changed the title
Cannot generate Markdown file from API definition in YAML
Cannot generate Markdown file from valid API definition in YAML
Aug 7, 2023
This code assumes that path items only contain operation items (which would return a python object that has the get() method). Based on the OpenAPI spec we see that the $ref, summary, and description field can be included, as well as, lists of server objects (servers) or parameter to reference mappings (parameters).
In the example above, for instance, the description field is being used and not finding a .get() method on the Python string.
I cannot generate Markdown file from properly validated API definition file:
API definition file swagger.yaml (validated with https://github.com/OpenAPITools/openapi-generator):
In my virtual environment (venv) the following PyPi dependencies are used:
My environment:
Am I missing something?
The text was updated successfully, but these errors were encountered: