mia-platform / mia-platform/lc39
The prefix with or without trailing slash is applied erroneously to the simple API /
- Dominant language
- JavaScript
- Stars
- 20
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
## The description of the bug or the rationale of your proposal
If it is configured a custom prefix and there is a API with path '/', the resulting OAS documentation is wrong.
## A snippet of code for replicating the issue or showing the proposal usage if applicable
Using the prefix `/prefix/` and registering the `GET /` the OAS is the following (see this test https://github.com/mia-platform/lc39/blob/5aa476965ce8a739d69e334de092fc9193fb71f1/tests/documentation-routes.test.js#L56):

Using the prefix `/prefix` and registering the `GET /` the OAS is the following (see this test https://github.com/mia-platform/lc39/blob/5aa476965ce8a739d69e334de092fc9193fb71f1/tests/documentation-routes.test.js#L82):

Note
Consider that in these tests fastify use the default settings:
- ignoreTrailingSlash: false (https://fastify.dev/docs/latest/Reference/Server/#ignoretrailingslash)
- prefixTrailingSlash: 'both' (https://fastify.dev/docs/latest/Reference/Routes/#routes-options)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the two cases in tests/documentation-routes.test.js, linked around lines 56 and 82, and compare the generated OAS paths for prefixes with and without a trailing slash. Read the route documentation generation entry point used by these tests, keeping Fastify's ignoreTrailingSlash and prefixTrailingSlash defaults in mind. Done means both prefix forms produce the correct path for a registered GET / route.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100