#4788: remove System.getProperty in DefaultGenerator#5119
Closed
ePaul wants to merge 2 commits intoswagger-api:masterfrom
Closed
#4788: remove System.getProperty in DefaultGenerator#5119ePaul wants to merge 2 commits intoswagger-api:masterfrom
ePaul wants to merge 2 commits intoswagger-api:masterfrom
Conversation
6b6f9ef to
dba48f7
Compare
Contributor
Author
|
Fixed the tabs. (I guess I'll need to reconfigure my home IDE.) |
Instead, we pass a systemProperties map in ClientOptInput.
dba48f7 to
5230f08
Compare
5230f08 to
eb598e3
Compare
Contributor
Author
|
This needs some reconsideration, I'll reopen it later. |
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.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change.(I tried to run all ... there are many unrelated changes. So I first opened a bunch of PRs for just updating the stuff. More to come. When those are merged, I'll rebase this on master and run it again.) ❌ Please do not merge yet.
2.3.0branch for breaking (non-backward compatible) changes. → not sure, see below.Description of the PR
(This is a part of a larger effort to get rid of the usage system properties for customizing the behavior of Swagger-Codegen, see #4788.)
Old state
DefaultGenerator was using System.getProperty for these purposes:
debugSwaggerdebugModelsdebugOperationsdebugSupportingFilesmodelTestsapiTestsmodelDocsapiDocssupportingFilesapismodelsChanges
We introduced a
systemPropertiesproperty (aMap<String,String>) in ClientOptInput, which is used by DefaultGenerator instead of System.getProperty() now. I introduced some private convenience methods here to make the access easier for the three use cases we have.CodegenConfigurator now puts its own
systemPropertiesmap (which comes from either the maven plugin or the CLI's-Doptions) into this field. (Currently, it also usesSystem.setProperty, I'll remove this in a later PR when all usages are removed.)One test which used System.setProperties needed to be fixed.
Open issues
Samples: I did not update any samples. In theory, those should not be affected, but who knows if I missed anything. I tried to use bin/run_all_petstore, but there were many (mostly unrelated) changes. So I started to update samples based on master first (see e.g. #5118 and #5117, there will be some more.)
Breaking change? I'm not sure this counts as a breaking change. Strictly said, if one did give those properties as real system properties (e.g. in the CLI version with
-DapiDocs=falsebefore the class name instead of after it, or in maven from outside the project instead of in the<systemProperties>element), it won't work anymore. For the "usual" way of giving them (<systemProperties>or-Dafter the class name), it still works. Should this go into master, 2.3.0 or even a later version?Should we introduce some compatibility layer, which fetches real system properties and collects them into the
systemPropertiesmap?