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

[16.0][FIX] Allow endpoint with slash in root path #344

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

flachica
Copy link
Contributor

If I define a endpoint with slash in Root path this is not found and throw an 404 error

@OCA-git-bot
Copy link
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@flachica flachica force-pushed the 16.0-fastapi_allow_slash_in_endpoint branch from 88c6869 to 694a0e2 Compare June 13, 2023 15:25
Copy link
Sponsor Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@flachica IMO it's a bad idea since / as Root path could lead to collision with Odoo's routes. Your app should always have its specific root path as mount point into the Odoo server. I should enforce this rule on the fastapi.endpoint model.

@flachica
Copy link
Contributor Author

@lmignon First of all, thank you very much for your time.
Regarding the PR issue, I don't know if I'm understanding you. With my proposal I try that the "Root path" can contain the example values: "/app", "/app/v1" and "/app/v2".

Currently it would only be possible to define "/app". With the proposed change the rest of the values would be allowed.

@lmignon
Copy link
Sponsor Contributor

lmignon commented Jun 14, 2023

@flachica OK I understand now your point. The problem is wider. How can we deal with subpath into the root path at the same time of subpath in route? A route could also be declared as 'sales/items/'. I've to thing a little bit further to implement the right logic and support subpath for apps and routes.

@flachica flachica force-pushed the 16.0-fastapi_allow_slash_in_endpoint branch 2 times, most recently from 5974528 to eca9d14 Compare July 18, 2023 10:23
@flachica flachica force-pushed the 16.0-fastapi_allow_slash_in_endpoint branch from eca9d14 to 839d89b Compare August 1, 2023 06:49
Copy link

github-actions bot commented Dec 3, 2023

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 3, 2023
@simahawk
Copy link
Contributor

simahawk commented Jan 5, 2024

@flachica OK I understand now your point. The problem is wider. How can we deal with subpath into the root path at the same time of subpath in route? A route could also be declared as 'sales/items/'. I've to thing a little bit further to implement the right logic and support subpath for apps and routes.

@lmignon can you elaborate a bit on the issues you foresee?
In theory this should work out of the box. It's even documented here https://fastapi.tiangolo.com/reference/fastapi/ app = FastAPI(root_path="/api/v1").

I haven't tried yet tho.

Also, depending on the use case you can use prefix in the routers to nest routes.

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 7, 2024
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants