question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defaultVersion is not reflected in generated endpoint URLs (new versioning API)

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When defining the API versioning with defaultVersion the generated endpoint URLs are not accounting for the version prefix:

app.enableVersioning({ type: VersioningType.URI, defaultVersion: '1', });

Minimum reproduction code

https://github.com/shprota/swagger-example

Steps to reproduce

  1. yarn
  2. yarn start:dev
  3. open http://localhost:3007/api
  4. Default controller is explicitly annotated with a version and is callable
  5. Cats controller uses the defaultVersion and trying to execute it from the generated document leads to 404

Expected behavior

URLs of the endpoints be correct accounting for defaultVersion parameter.

Package version

5.1.3

NestJS version

8.1.1

Node.js version

14.16.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ConstantinePoltyrevcommented, Oct 21, 2021

Thank you, @micalevisk !

0reactions
kamilmysliwieccommented, Oct 22, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Defaulting to the Latest API Version on Swagger UI
This is now working, and I can set the API version at the top of the page to resolve to the various exposed...
Read more >
How to use API versioning in .NET Core Web APIs using .NET 6
In this tutorial I will show you how to integrate API versioning in your .NET Core Web API (using .NET 6) to easily...
Read more >
NET 5 - Use API versioning - Level Up Coding
We will use the default version (1.0) if a version is not specified in the request (if we don't define a version, all...
Read more >
Dealing with default API versions in Swagger UI
Although default version route is not visible in Swagger it is still available, so endpoint can be accessed both from /v1/users and /users,...
Read more >
.NET Core 3.1 Web API - Keeping Different API Versions In A ...
This article covers a practical scenario of maintaining a single code base with different versions of the same APIs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found