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

Endpoint to support multiple api versions #1488

Closed
2 of 4 tasks
ben-leonard-tbol opened this issue Oct 2, 2023 · 3 comments
Closed
2 of 4 tasks

Endpoint to support multiple api versions #1488

ben-leonard-tbol opened this issue Oct 2, 2023 · 3 comments
Labels

Comments

@ben-leonard-tbol
Copy link

ben-leonard-tbol commented Oct 2, 2023

I currently have a single version of an api with the following resources which contains endpoints for creating a product, retrieving all etc. v1/products v1/orders.

In order to support this I have a controller attributes like @Route('v1/products'). I now need a new version of my api, products endpoints need a breaking change so I have a new controller for that and the appropriate functions with the @Route('v2/products') attribute.

The orders endpoint never changes except for the version. So I was hoping to add another attribute with the new version which would mean two route attributes are added but I get the following error Only one Route decorator allowed. I could duplicate the controller code and update the route but this added a lot of duplicate code.

Whats the best mechanism to support multiple versions for a controller?

Sorting

  • I am submitting a support ticket to understand if the preferred mechanism to support this

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

Ability to add another Route attribute to identify a given controller should work for multiple routes.

Current Behavior

Adding another Route attribute Only one Route decorator allowed

Possible Solution

Assuming support of multiple Route attribute / accept an array. There might be better solutions that currently exist.

@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Hello there ben-leonard-tbol 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

Copy link

github-actions bot commented Nov 2, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Nov 2, 2023
@github-actions github-actions bot closed this as completed Nov 7, 2023
@HarryVGI
Copy link

HarryVGI commented Mar 8, 2024

Hey @ben-leonard-tbol!

Did you proceed by duplicating the controller code or did you find a more elegant solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants