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.

setBasePath method is missing in DocumentBuilder since version 4.0

See original GitHub issue

I’m submitting a…


[ ] Regression 
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The method setBasePath(basePath: string) is missing in the current (4.0.9) @nestjs/swagger version.

Expected behavior

Have a method to set base path as it was in older versions, for example (3.1.0)

Minimal reproduction of the problem with instructions


const options = new DocumentBuilder()
  .setTitle('example')
  .setBasePath('/example')
  .build();

will result 'Property ‘setBasePath’ does not exist on type ‘DocumentBuilder’

What is the motivation / use case for changing the behavior?

Have the ability to set swagger with base path

Environment


Nest version: Nest version: @nestjs/swagger@4.0.9
 
For Tooling issues:
- Node version: 12.14.0 (LTS)
- Platform:  Mac and Windows

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kamilmysliwieccommented, Dec 27, 2019

setBasePath is no longer required (a global path will be populated automatically). If you want to have more control over that, you can use addServer.

For better developer experience, I’ve added depracated setBasePath in 4.1.1 release to inform devs on how to migrate from the previous API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SetBasePath not present in ConfigurationBuilder under .NET ...
According to the docs for .NET Core 5, there's a method SetBasePath and it's widely used in a bunch of ...
Read more >
FileConfigurationExtensions.SetBasePath ... - Microsoft Learn
Sets the FileProvider for file-based providers to a PhysicalFileProvider with the base path.
Read more >
XMLConfiguration (Apache Commons Configuration 1.10 API)
If no specific builder has been set, this method returns null. Returns: the DocumentBuilder for loading new documents; Since: 1.2. setDocumentBuilder.
Read more >
Index (||Oracle Database XML Java API Reference||)
Creates a new XQItemType object representing the XQuery document-node(elementType) type containing a single schema-element(...) createDocumentType() - Method in ...
Read more >
API with NestJS #60. The OpenAPI specification and Swagger
However, since it might be confusing, it is worth outlining the ... The DocumentBuilder class contains a set of methods we can use...
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