Skip to content

swaggerConfig.json swagger.host value is prepended by "self-protocol" even when protocol is included in the value #144

@agingrich

Description

@agingrich

swaggerConfig.json's property at swagger.host property value gets prefixed with the self-protocol slashes ("//"), even when the protocol is included with the host value.

Example:

The prefix appears in both output formats: yaml and json.

Breaks SDK generators by confusing them and causing them to re-translate the host into the client's configured protocol. Or when absent, defaults to "http". End result becomes "http://http://someserver.com"

Screenshots attached.

Steps to reproduce:

  • Build NodeJS RESTful API with Typescript
  • Using typescript-rest decorators
  • Configure swaggerConfig.json with HTTP protocol as part of the "host" property value.
  • Execute swaggerGen <path-to-swaggerConfig.json>
  • In this use-case, client SDK was generated using @openapitools/openapi-generator-cli
  • Generate SDK from swagger definition output from above
  • Observe relevant results in all outputs in above steps

[swaggerConfig.json]
swaggerConfig

[swagger.yaml]
swagger-yaml

[swagger.json]
swagger-json

[Service base-class configuration result in SDK]
sdk-output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions