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

fix: multiple formats for custom "api_doc" route example #2122

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

Conversation

phansys
Copy link
Contributor

@phansys phansys commented Jan 8, 2025

Without the _format option, the resulting route is not able to expose other paths like /api_documentation.jsonopenapi.

Comment on lines +458 to +519
methods: ['HEAD', 'GET']
defaults:
_format: html
Copy link
Member

Choose a reason for hiding this comment

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

Are these necessary as well?

Copy link
Contributor Author

@phansys phansys Jan 9, 2025

Choose a reason for hiding this comment

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

I think so. Without the methods definition, the route will accept any HTTP verb.

This condition was added in version 3.3.7.

The default format is required for the routing to match the /api_documentation.{_format} pattern. Otherwise, a request to the /api_documentation path results in 404, as the pseudo-extension (.html in this case) is missing.

@phansys phansys requested a review from alanpoulain January 9, 2025 14:31
@soyuka
Copy link
Member

soyuka commented Jan 13, 2025

shouldn't we merge this on a 3.x branch?

@phansys
Copy link
Contributor Author

phansys commented Jan 13, 2025

shouldn't we merge this on a 3.x branch?

I've chosen the 2.7 branch, as this branch is the older one where the route is defined. The version 3.3.7 was the first one introducing these improvements / fixes in the default route definition, although I guess this situation is not a blocker to provide these changes from the branch where the route was introduced.

Please, let me know if you agree. Otherwise, I can update the target branch to 3.7 based on your answer.
Thank you.

@vinceAmstoutz
Copy link
Contributor

shouldn't we merge this on a 3.x branch?

I've chosen the 2.7 branch, as this branch is the older one where the route is defined. The version 3.3.7 was the first one introducing these improvements / fixes in the default route definition, although I guess this situation is not a blocker to provide these changes from the branch where the route was introduced.

Please, let me know if you agree. Otherwise, I can update the target branch to 3.7 based on your answer. Thank you.

@phansys Yes, you're right but we currently support >= 3.3 branches. Please target the 3.4 branch for this one. For more details check out our Maintenance documentation.

@phansys phansys changed the base branch from 2.7 to 3.4 January 14, 2025 12:02
@phansys
Copy link
Contributor Author

phansys commented Jan 18, 2025

The target branch was changed to 3.4. Thanks.

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.

4 participants