blueswen / mkdocs-swagger-ui-tag

A MkDocs plugin supports adding Swagger UI to the page.
https://blueswen.github.io/mkdocs-swagger-ui-tag/
MIT License
75 stars 7 forks source link

Incompatible with "--no-directory-urls" #3

Closed Fabbi closed 2 years ago

Fabbi commented 2 years ago

If you export the documentation with use_directory_urls: false or --no-directory-urls mkdocs crashes with

IsADirectoryError: [Errno 21] Is a directory: '/[...]/index.html'

After disabling swagger-ui-tag it works again.

mkdocs seems to generate the documentation twice with this option and the first time with folders instead of files.

Fabbi commented 2 years ago

So I dug a bit into this and it seems like https://github.com/blueswen/mkdocs-swagger-ui-tag/blob/11454acf086f4b269f1a2e5143e4851afdf9f4fd/mkdocs_swagger_ui_tag/plugin.py#L95 is the problem.

page.url becomes the full filename like api/index.html instead of just api/. So if you remove the last part it builds again.

But now swagger has a problem opening the openapi.yaml due to

Fetch API cannot load file:///[...]/openapi.yaml due to access control checks.
blueswen commented 2 years ago

@Fabbi Thanks for reporting this issue and some digging. I will release a new version to fix the page_dir bug later. Thanks again !

blueswen commented 2 years ago

@Fabbi Version 0.3.1 is compatible with use_directory_urls: false or --no-directory-urls now.