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

Server url missing port #825

Open
2 tasks done
BossHogg97 opened this issue Sep 26, 2024 · 5 comments
Open
2 tasks done

Server url missing port #825

BossHogg97 opened this issue Sep 26, 2024 · 5 comments

Comments

@BossHogg97
Copy link

BossHogg97 commented Sep 26, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.0.0

Plugin version

9.0.0

Node.js version

21.7.3

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

Windows 11

Description

Hi, i update the Fastify version to the latest and also all related plugins.
When i define the server object inside swagger plugin the port is not shown on swagger-ui and also inside openApi definition.

 await fastify.register(
    fastifySwagger,
    withRefResolver({
      openapi: {
        info: {
          title: 'Test',
          description: 'Description test',
          version: `ver. ${process.env['npm_package_version']} | Build date: ${buildDate}`
        },
        servers: [
          {
            url: `${config.swaggerServerUrl}${config.proxyPath}`,
          }
        ],
.....

I logged the config.swaggerServerUrl and is correct.

image

How can i solve this? Thanks :)

Link to code that reproduces the bug

https://github.com/BossHogg97/fastify-ver-5

Expected Behavior

The server url has to be : http://localhost:5015

@mcollina
Copy link
Member

Is this a problem in swagger-ui only?

@BossHogg97
Copy link
Author

No, also in the definition of openApi file

@BossHogg97
Copy link
Author

Any update? :)

@mcollina
Copy link
Member

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@R-Campbell
Copy link
Contributor

Is it possible this line in your swagger-ui registration is removing the port in non-production environments?

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

No branches or pull requests

3 participants