Skip to content

(WIP) Derives a dependency graph from OpenAPI schema documents

License

Notifications You must be signed in to change notification settings

anentropic/apigraph

Repository files navigation

apigraph

Derives a dependency graph from your OpenAPI 3.0 schema documents.

WIP, not published to PyPI yet.

See docs here: https://apigraph.readthedocs.io/

Introduction

For usage examples see test_graph_building.py and test_chains.py.

This interface will likely change, but for now it looks like:

from apigraph.graph import APIGraph
from apigraph.types import NodeKey

apigraph = APIGraph(openapi_yaml_doc_uri)
dependency_chain = apigraph.chain_for_node(
    node_key=NodeKey(doc_uri, "/2.0/repositories/{username}", "get"),
    chain_id="default",
    traverse_anonymous=traverse_anonymous,
)

Here dependency_chain will be a networkx.MultiDiGraph instance containing a graph of all the pre-requisite operations, the edges will have data attached detailing how values from the preceding response are used in the destination request.

Development

Install https://pre-commit.com/ e.g.

brew install pre-commit
pre-commit install

To preview the .rst docs via a local webserver:

sphinx-reload docs/

About

(WIP) Derives a dependency graph from OpenAPI schema documents

Resources

License

Stars

Watchers

Forks

Packages

No packages published