Skip to content

Stop using the OpenAPI schema to drive the UI (?) #415

Description

@dantownsend

Related to piccolo-orm/piccolo#1086

The UI of Piccolo Admin is largely driven by OpenAPI schemas (generated via create_pydantic_model in Piccolo).

We augment the OpenAPI schemas with Piccolo specific metadata (under the extra attribute).

Pydantic allows us to do this, and it has worked pretty well up until now. But other libraries (Litestar) complain if an OpenAPI schema has any custom attributes.

It should be possible to add custom attributes, as long as they start with x-, but we can't work out how to do it and still keep Litestar happy.

Which just leaves us with these options:

  1. Completely replace the current schema endpoint with our own custom one.
  2. Keep the current /schema endpoint in Piccolo Admin (minus all of the custom attributes), and have a second endpoint (something like /meta) which contains all of the custom attributes. The downside is it means 2 API calls instead of 1.
  3. Have our own custom endpoint, but embed the existing schema JSON within it. Something like {"schema": ..., "custom": ...}.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions