r/FastAPI • • Nov 26 '22

Question Is FastAPI missing contributors?

Post image
65 Upvotes

54 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Nov 27 '22

Honestly? No clue. But if you’ve standardized your APIs at all, it may not be that difficult to convert. We’ve been using Jinja2 in order to generate a lot of boiler plate code. If the concepts in Fastapi conceptionally mapped to starlite it shouldn’t be that difficult to create some sort of translation.

2

u/monorepo Dec 23 '22

Starlite had a conversion example guide for {flask,fastapi,etc} -> starlite if it helps.

https://starlite-api.github.io/starlite/migration/

1

u/XxDirectxX Nov 27 '22

Hey, thanks for the fastReply. Do you mean standardized as in separating logic in "modular" format? I build my APIs as such:
first we save parameter values as JSON and then perform data sanitization through pydantic validators. Then I send the requisite data to utility programs and perform any data type conversion/ formatting as per need. Then add the requisite information to a dict and return the response.

The business logic is handled by utility functions in a different package and even there I try to group code together in a chunk and separate out code that might be used by more than 1 function.

Sorry if this is a bit vague or seems unrelated, I am a fresher who's been on the job for 5 months now and am trying to learn as much as possible.

2

u/[deleted] Nov 27 '22

I more mean consistency, I don't know what your code base looks like, but if you've implemented FastAPI in a similar fashion for all your APIs it is in a sense a template.

If the concepts in your template map nicely to how Starlite works and you have a lot of code it may make sense to look at a templating engine like Jinja2 to generate the basic Starlite code.

I would just recommend trying to reimplement one of your APIs in Starlite to see how difficult it would be.