Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Enhancement: Support Swagger #45

Open
code4rain opened this issue Dec 5, 2022 · 8 comments
Open

Enhancement: Support Swagger #45

code4rain opened this issue Dec 5, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@code4rain
Copy link

code4rain commented Dec 5, 2022

Is your feature request related to a problem? Please describe.
FastAPI supports OpenAPI as builtin.
Is it possible to support OpenAPI to describe detail spec for another client which want to create, read, update, delete?

Describe the solution you'd like
support API endpoint with OpenAPI description such as FastAPI does.

Describe alternatives you've considered

Additional context

@code4rain code4rain added the enhancement New feature or request label Dec 5, 2022
@jowilf
Copy link
Owner

jowilf commented Dec 6, 2022

Hello @code4rain,
I'm not sure if I understood your request correctly,
Do you mean some kind of ApiView to support CRUD on models via REST API?

@code4rain
Copy link
Author

code4rain commented Dec 7, 2022

Hello @jowilf

Please refer below.
https://fastapi.tiangolo.com/features/#automatic-docs

Is it possible to show the rest api style(json style return) by starlette-admin?

Currrently starlette-admin generate rest api which return HTML(jinja2 based) instead of simple json style data.

  • Only I found the json style return by list api with skip and limit. I can not find create, edit, delete for it.

Thanks for your reply 😊

@jowilf
Copy link
Owner

jowilf commented Dec 10, 2022

Hello @code4rain,

Only the listing page follow OpenApi specification to serve datatables through RestAPI, the others endpoint use POST (multipart/form-data) request and they can't follow OpenAPI Specification due to some limitations with the way dynamic list and embedded document are handle with html and Javascript.

Take a look at this. You can see how the browser make the POST request with dynamic list (eg. array.1 array.2 array.3)

@jowilf jowilf closed this as completed Dec 10, 2022
@code4rain
Copy link
Author

@jowilf Thank for explain. I will check the code as you mentioned.

@jowilf
Copy link
Owner

jowilf commented Dec 13, 2022

@code4rain check my edited answer. I'm not sure it was clear

@code4rain
Copy link
Author

@jowilf Actually, I'm using FastAPI as backend for my service and communicated with FE engineer by OpenAPI (Swagger).
FE engineer does not know about internal implementation of backend.
And currently, I used starlette-admin for internal admin page and make new router to communicated with FE engineer to describe the models which backend handle.

I made this issue to prevent to make new router code if possible. :)

@jowilf
Copy link
Owner

jowilf commented Dec 13, 2022

Sounds like a good idea, I'll reopen the issue and take a look at it when I have some free time to spend on it.

@jowilf jowilf reopened this Dec 13, 2022
@hasansezertasan
Copy link
Contributor

Is there any improvement on this one? FastAPI depends on Pydantic to generate the OpenAPI Schema. Supporting this feature would probably make Pydantic a requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants