mkdocs-plugins icon indicating copy to clipboard operation
mkdocs-plugins copied to clipboard

mkdocsoad: Failed to read source

Open LuisHPorras opened this issue 1 year ago • 2 comments

First of all, thanks a lot for your work, looks great and I'm willing to be able to test it and make use of it!

Problem

I'm just trying to make use of the plugin but I'm not able to do it. I'm following the docs, install the dependencies, configure the mkdocs.yml:

# ... some config

nav:
    - Inicio: index.md
    - 'Hoja de ruta': roadmap.md
    - Cliente: 
        - Inicio: client/index.md
    - Servidor: 
        - Inicio: server/index.md
        - API: server/api.md
    - 'Meta-documentación': metadocs.md

# ... more config

plugins:
    - search
    - git-revision-date
    - neoteroi.mkdocsoad:
        use_pymdownx: true

markdown_extensions:
    - admonition
    - pymdownx.details
    - pymdownx.superfences
    - pymdownx.tabbed:
        alternate_style: true
    - toc:
          permalink: true

Create the new entry in the docs ./server/api.md:


# __API__

[OAD(./openapi.yaml)]

Provide the openapi generated json file in the samse directory. And I get the following error when launching mkdocs serve:

ValueError: Invalid source: it must be either a path to .json or a .yaml file, or a valid URL. 

I'm using Swagger editor to validate the openapi file and it doesn't contain errors. You can find the code at PROECOS branch 19-documentation

I haven't found much information for troubleshooting in the docs, I'll be willing to PR with updated docs if we get to find the solution.

Cheers!

LuisHPorras avatar Aug 17 '24 13:08 LuisHPorras

I've got the same issue, not including [OAD(./openapi.json)] in the md file makes mkdocs build succeed. Having it included fails with noted error.

mscheerschmidt-mhp avatar Aug 26 '24 15:08 mscheerschmidt-mhp

You need to add the relative path of the swagger file starting from the mkdocs.yml For example, if your swagger file is in /docs/swagger/file.json, You need to attach it in your md file like that [OAD(docs/swagger/operator_to_npc-v1.1.json)], ignoring the location of your md file

mohammed6688 avatar Jun 18 '25 15:06 mohammed6688