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

Controller generator is creating duplicates entries in config/router.py #78

Closed
1 task done
rszamszur opened this issue Apr 22, 2022 · 0 comments · Fixed by #92
Closed
1 task done

Controller generator is creating duplicates entries in config/router.py #78

rszamszur opened this issue Apr 22, 2022 · 0 comments · Fixed by #92
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rszamszur
Copy link
Member

  • I have searched the issues of this repo and believe that this is not a duplicate.

Describe the bug

$ fastapi-mvc generate controller demo method1 method2:post
[INFO] Running controller generator
(.venv) 
$ fastapi-mvc generate controller demo method1 method2:post
[INFO] Running controller generator
$ cat test_app/config/router.py 
"""Application routes configuration.

In this file all application endpoints are being defined.
"""
from fastapi import APIRouter
from test_app.app.controllers import demo
from test_app.app.controllers import demo
from test_app.app.controllers.api.v1 import ready

router = APIRouter(prefix="/api")

router.include_router(ready.router, tags=["ready"])
router.include_router(demo.router)
router.include_router(demo.router)

Expected behavior

Controller generator should validate if an entry already exists. If --skip flag is provided, don't override; else override.

To Reproduce

Run the same controller generator twice.

Environment

  • Python version: 3.9.6
  • Operating System: Linux-5.10.106-x86_64-with-glibc2.33
  • fastapi-mvc version: 0.10.0

Additional context

This is implemented in controller generator template post_gen_project.py hook.

@rszamszur rszamszur added the bug Something isn't working label Apr 22, 2022
@rszamszur rszamszur self-assigned this Apr 22, 2022
@rszamszur rszamszur added this to the 0.11.1 milestone Apr 24, 2022
rszamszur added a commit that referenced this issue Apr 27, 2022
Fix controller generator creating duplicates entries in `config/router.py`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant