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.
[PowerShell] Fix proxy type (@wing328)
The file
configuration.mustache
inmodules/openapi-generator/src/main/resources/powershell/configuration.mustache
contains the following check in the functionSet-{{{apiNamePrefix}}}Configuration
The check fails in multiple environments, either because the type checked is unknown, or because the class returned by
GetSystemWebProxy()
is different from what is expected.$PSVersionTable
Name Value ---- ----- PSVersion 5.1.19041.4046 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.4046 [...]
Name Value ---- ----- PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.19045 Platform Win32NT [...]
Name Value ---- ----- PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:31 PST 2024; root:xnu-1006… Platform Unix [...]
[System.Net.SystemWebProxy]$a
Unable to find type [System.Net.SystemWebProxy]. At line:1 char:2 + [System.Net.SystemWebProxy]$a + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.SystemWebProxy:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound
InvalidOperation: Unable to find type [System.Net.SystemWebProxy].
InvalidOperation: Unable to find type [System.Net.SystemWebProxy].
([System.Net.WebRequest]:: GetSystemWebProxy()).GetType()
IsPublic IsSerial Name BaseType -------- -------- ---- -------- False False WebProxyWrapperOpaque System.Object
IsPublic IsSerial Name BaseType -------- -------- ---- -------- False False HttpWindowsProxy System.Object
IsPublic IsSerial Name BaseType -------- -------- ---- -------- False False MacProxy System.Object
Since all returned types implement (and by the available doc, shall implement) the interface
IWebProxy
, I propose to replace the above test withThe change does not guarantee that the configured proxy will work on all systems (e.g. on Linux the default class is HttpNoProxy, and on MacOS proxy credentials are likely not yet implemented). Yet, when using the command
the request and response are intercepted as requested in the proxy, and can be used for debugging.
The test can be made by using e.g. Burp Suite Community Edition, enabling the proxy on 127.0.0.1:8080 and using the line above to configure the PowerShell PetStore client API.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.1.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)