fix(docker): emit literal null for string env vars set to "null"#10860
Open
yogeshwaran-c wants to merge 1 commit into
Open
fix(docker): emit literal null for string env vars set to "null"#10860yogeshwaran-c wants to merge 1 commit into
yogeshwaran-c wants to merge 1 commit into
Conversation
The Docker entrypoint translator was emitting the string `"null"` for any string-typed env var assigned the literal value `null` (e.g. `VALIDATOR_URL=null`). Per docs/usage/configuration.md, `null` is the documented way to disable the validator badge, but the resulting `validatorUrl: "null"` was treated as a URL and produced a broken link. Detect the literal string "null" in the translator and emit the JS `null` value instead so that the documented behaviour works for any string-typed config variable (URL, VALIDATOR_URL, FILTER, etc.). Refs swagger-api#5519
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Docker entrypoint translator emits the string
"null"instead of the JS literalnullwhenever a string-typed env var is set tonull(e.g.VALIDATOR_URL=null). Per docs/usage/configuration.md,nullis the documented way to disable the validator badge:Today, running
injects
into the swagger-initializer.js, which the validator badge component then treats as a relative URL and renders as a broken link.
This change makes the translator detect the literal string
"null"for string-typed config variables and emit the JSnullvalue instead, restoring the documented behaviour. The fix applies to every string-typed config variable (URL,VALIDATOR_URL,OAUTH2_REDIRECT_URL,FILTER, etc.), which matches what the issue reporter and follow-up commenters described.Motivation and Context
Closes #5519. The bug was acknowledged by a maintainer in the original thread:
A follow-up comment confirmed it also breaks
URL=null(and any other string variable that allowsnull), which the present fix addresses.How Has This Been Tested?
npm run test:unit -- test/unit/docker/translator.js— 17 tests pass (15 existing + 2 new).npx eslint --max-warnings 0 docker/configurator/translator.js test/unit/docker/translator.js— clean.VALIDATOR_URL=nulland the more general case (URL=null,FILTER=null).The translator is build-time configuration code (it edits the dist HTML before nginx serves it), so it does not have a Cypress/browser surface to exercise.
Checklist