arcee-python icon indicating copy to clipboard operation
arcee-python copied to clipboard

Set up openapi spec

Open Ben-Epstein opened this issue 2 years ago • 2 comments

https://github.com/openapi-generators/openapi-python-client

Ben-Epstein avatar Sep 22 '23 23:09 Ben-Epstein

Was able to generate an API client with this invoke task:

@task
def codegen(ctx: Context, openapi_url: Optional[str] = "https://app.arcee.ai/api/openapi.json") -> None:
    """codegen

    Generate code from Arcee's OpenAPI spec
    """
    ctx.run(
        "uv pip install --upgrade openapi-python-client",
        pty=True,
        echo=True,
    )
    ctx.run(
        f"openapi-python-client generate --url {openapi_url} \
            --meta none \
            --overwrite \
            --no-fail-on-warning \
            --config openapi-config.yml \
            --output-path arcee/codegen",
        pty=True,
        echo=True,
    )
    # Format the generated code
    ctx.run(
        "black arcee/codegen",
        pty=True,
        echo=True,
    )
    ctx.run(
        "ruff check arcee/codegen --fix --fix-only",
        pty=True,
        echo=True,
    )

nason avatar Jun 13 '24 13:06 nason

Oh sorry @nason, I didn't realize this was still active! I only looked at the date of the initial comment and assumed it was dead, but now I see your comment was from last week.

(was just trying to clean up the inactive issues a bit)

tleyden avatar Jun 20 '24 10:06 tleyden