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

Feature/generate routers #344

Merged
merged 20 commits into from Apr 27, 2023
Merged

Conversation

v1kAn0v
Copy link
Contributor

@v1kAn0v v1kAn0v commented Apr 23, 2023

Hello koxudaxi,

Let me introduce myself first.

I am Data Engineer working for an Elbit Systems (Israeli Company)

We widely use your fastapi-code-generator in one of our application API's.

I faced necessarily to split large API main.py into routers grouped by Tags corresponding to same model.py, using shared dependencies.py and routed to single main.py (as it recommended by tiangolo FastAPI APIRouter() approach here

I would like to contribute code I have developed so your code generator will support this feature with ease.
I believe it will help many developers across the globe enhance capabilities of their applications and allow to maintain it with ease when large application could be split apart based on tags defined in swagger .yaml. No need to regenerate entire main, only endpoints with tags you only intend to change. I think it could be great contribution to your code and to entire community.

I'll appreciate you will add me as a contributor to your project.

The code passed tests, format and doesn't affect your overall coverage. For more details please see README.md with explanations of usage.

Great day and thank You

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.81 🎉

Comparison is base (95867a7) 91.09% compared to head (dfd4483) 91.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
+ Coverage   91.09%   91.90%   +0.81%     
==========================================
  Files           5        6       +1     
  Lines         348      383      +35     
==========================================
+ Hits          317      352      +35     
  Misses         31       31              
Flag Coverage Δ
unittests 91.90% <100.00%> (+0.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
fastapi_code_generator/__main__.py 83.91% <100.00%> (+5.01%) ⬆️
...ode_generator/modular_template/dependencies.jinja2 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines 66 to 69
# if generate_routers:
# template_dir = BUILTIN_MODULAR_TEMPLATE_DIR
# Path(output_dir / "routers").mkdir(parents=True, exist_ok=True)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the commented lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course.
I removed it.

@koxudaxi
Copy link
Owner

@v1kAn0v
Thank you for creating the great PR.
Could you please check the one comment?

@koxudaxi koxudaxi merged commit 40068f2 into koxudaxi:master Apr 27, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants