Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
dantownsend opened this issue Sep 30, 2024 · 0 comments
Open

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

dantownsend opened this issue Sep 30, 2024 · 0 comments

Comments

@dantownsend
Copy link
Member

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": ...}.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant