Giter Club home page Giter Club logo

Comments (2)

guoquan avatar guoquan commented on August 30, 2024 1

If anyone is interested, I came up with a workaround merging the files at the build time in conf.py with prance.
(speccy ran into an infinite loop with my spec file)

However, it would be good if supported in the extension.

# conf.py

def resolve(path: str, to: str = None):
    import logging
    import subprocess
    import tempfile
    from os.path import basename, join

    if to is None:
        basenames = basename(path).rsplit(".", maxsplit=2)
        assert len(basenames) == 2
        # to = to or f"{path_names[0]}.resolved.{path_names[1]}"
        to = f"{join(tempfile.gettempdir(),basenames[0])}.resolved.{basenames[1]}"

    subprocess.run(["prance", "compile", path, to])
    logging.getLogger(__name__).info(f"Resolved {path} to {to}")

    return to

redoc = [
    {
        "name": "My API",
        "page": "my/api/index",
        "spec": resolve("my/api/index.yml"),
        "embed": True,
    },
]

from redoc.

guoquan avatar guoquan commented on August 30, 2024

With tools like https://github.com/wework/speccy we can allow a list of spec and merge them into one so that the current process is good.

from redoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.