Skip to content

Update the OpenAPI spec to just follow the readme.io convention #2

Open
@nikhilshinday

Description

@nikhilshinday

Hey @sigpwned! thanks for doing this. While browsing the documentation for pinecone, I realized that the official OpenAPI spec is loaded onto the page at runtime. There are two sections:

Screen Shot 2023-04-18 at 11 48 49 PM

and if you click into either, you'll see a request that looks something like:
Screen Shot 2023-04-18 at 11 50 25 PM

where reference/<slug> refers to the endpoint that's being selected in the sub-menu.

When you look at the JSON body, it has an openapi definition embedded in it!
Screen Shot 2023-04-18 at 11 52 28 PM
and the paths in that definition:
Screen Shot 2023-04-18 at 11 53 05 PM

When you click on any of the endpoints in the second sub-menu, the OpenAPI definition changes (probably because the authorization scoping is at the project-level rather than the index-level).

Effectively, all you have to do to keep this up-to-date is run:

index_openapi_definition = requests.get('https://docs.pinecone.io/reference/query?json=on').json()['oasDefinition']
controller_openapi_definition = requests.get('https://docs.pinecone.io/reference/create_collection?json=on').json()['oasDefinition']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions