-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid generating unused _baseUrl (C# gen)
- Loading branch information
Showing
3 changed files
with
27 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
202f3c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change BaseUrl to _baseUrl in the urlBuilder_?
I use GenerateBaseUrlProperty=false in my project and have base proxy classes that return the BaseUrl :(
202f3c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcheveau Is this the same problem as in #4705 ?
202f3c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olegd-superoffice yeah looks like
My case is:
useBaseUrl=true
generateBaseUrlProperty=false
I have a base class that implements BaseURL and return the baseurl to be used in urlBuilder but now it's ignored. The proxy is using directly _baseUrl
I totally agree on this:
In 14.0.3 code is getting compiled again but works differently - BaseUrl property is not generated and is not used at all. Instead private string _baseUrl field is assigned from a host value defined in OpenAPI document. The only workaround I could find to change _baseUrl value is to put some weird logic into override of PrepareRequest method.
202f3c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have the same issue. I use useBaseUrl=true and generateBaseUrlProperty=false. My base class has a BaseUrl property that I set via config. I relied on that in the generated code.
202f3c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in a different boat, but 14.0.3 was a breaking change for us. We invoke nswag with
useBaseUrl=false
. I don't setgenerateBaseUrlProperty
at all. This was working fine. Upon upgrading to 14.0.3, now the generated library is generating errors (we have warnings as errors turned on in all projects), because the client class is generated with the following new code that wasn't included in the client before recent changes:So now we either need to rollback to 14.0.2, which is a minor annoyance because it means publishing a new library to our internal NuGet server since we centralize our nswag code (we just updated it to 14.0.3 since it had been a month, figured the dust had settled), or manually delete these properties that are not used while waiting for a fix for this breaking change. This commit was completed a month ago, and it looks like it would fix the issue. When is 14.0.4 expected to be released @RicoSuter ?