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

No way to prevent encoding in serverVariables injection #3656

Closed
paztis opened this issue Sep 9, 2024 · 4 comments · May be fixed by jetboard/swagger-editor#5
Closed

No way to prevent encoding in serverVariables injection #3656

paztis opened this issue Sep 9, 2024 · 4 comments · May be fixed by jetboard/swagger-editor#5
Assignees
Labels
jira This is also tracked in Jira P2 pull-request-welcome That the core team don't have the resources, but would welcome a community PR type: bug

Comments

@paztis
Copy link

paztis commented Sep 9, 2024

Since this PR: https://github.com/swagger-api/swagger-js/pull/3557/files all the serverVariables are automatically encoded.
We use serverVariable to manage the protocol://host:port, but :// are encoded

https://github.com/swagger-api/swagger-js/blame/b52871ebcc396c873c5616724cd191547c730e4e/src/execute/index.js#L362

openapi-server-url-templating is allowing to provide customEncoder. Is it possible to add a topLevel optional serverVariablesEncoder to be able to cover our case ? Or to disable the encoding by default ?

the Saas and On-Premise specification provide this example of serverVariables https://swagger.io/docs/specification/api-host-and-base-path/
image

and it no more works

@ponelat ponelat added type: bug P2 pull-request-welcome That the core team don't have the resources, but would welcome a community PR labels Sep 13, 2024
@ponelat
Copy link
Member

ponelat commented Sep 13, 2024

Thank you @paztis, and good catch. We don't have the resources to look into this right now, but would welcome a PR :)

@ponelat
Copy link
Member

ponelat commented Sep 13, 2024

@char0n are you able to take a look though?

@ponelat ponelat added the jira This is also tracked in Jira label Sep 13, 2024
@char0n char0n self-assigned this Sep 13, 2024
@char0n
Copy link
Member

char0n commented Sep 13, 2024

Hi @paztis,

Thanks for the issue.

If we want to support “SaaS on On-Premise” usecase, which we do - then we have to turn off the default encoding.
We can also introduce a config option to SwaggerJS to turn the encoding on/off, with the default behavior turned off.

I'm on it.

char0n added a commit that referenced this issue Sep 13, 2024
This will allow Saas and On-Premise usecase to be handled correctly.
Encoding can be turned on again by providing
serverVariableEncoder option.

Refs #3656
@char0n
Copy link
Member

char0n commented Sep 13, 2024

Addressed in #3660

@char0n char0n closed this as completed Sep 13, 2024
swagger-bot pushed a commit that referenced this issue Sep 13, 2024
## [3.29.3](v3.29.2...v3.29.3) (2024-09-13)

### Bug Fixes

* **execute:** do not encode server variables by default ([6a151d9](6a151d9)), closes [#3656](#3656)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira This is also tracked in Jira P2 pull-request-welcome That the core team don't have the resources, but would welcome a community PR type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants