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(@nestjs/swagger): replace quoted functionPlaceholder completely #1963

Merged

Conversation

Panzer1119
Copy link
Contributor

@Panzer1119 Panzer1119 commented Jul 8, 2022

When building JS InitOptions, functions get replaced by a placeholder.
JSON.stringify quotes strings, so we need to replace the placeholder
including the quotes.

Fixes: #1962

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #1962

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

When building JS InitOptions, functions get replaced by a placeholder.
JSON.stringify quotes strings, so we need to replace the placeholder
including the quotes.

Fixes:  nestjs#1962
@flamewow
Copy link
Member

LGTM
one minor comment +
@Panzer1119 can you please add a function to e2e/manual-e2e.ts to cover the case you've found

smth like:

  SwaggerModule.setup('/swagger-docs', app, document, {
    customSiteTitle: 'Demo API - Swagger UI 2',
    swaggerOptions: {
      persistAuthorization: true,
      defaultModelsExpandDepth: -1,
      operationsSorter: (a, b) => a.get('id').localeCompare(b.get('id')),
    }
  });

@Panzer1119
Copy link
Contributor Author

Done

@kamilmysliwiec kamilmysliwiec merged commit 408e39d into nestjs:master Jul 11, 2022
@kamilmysliwiec
Copy link
Member

LGTM

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.

Version 6 doesn't correctly generate swagger-ui-init.js
3 participants