[feat][csharp][unity] Add unity 2019 support and update samples #21036
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.
Summary
This PR adds support Unity 2019+ with some small updates to the api client and exception classes. The code here is also introducing a new awaiter extension in the Unity WebRequest library. This allows the generated client code to use concise and idiomatic
await asyncOp
syntax even in older Unity versions like 2019 LTS, whereUnityWebRequestAsyncOperation
does not natively support awaiting.Motivation
I could not generate a client using Unity 2019 and the changes here have enabled me to generate openapi clients for the version of Unity that I am stuck with. I figured that this would also be very helpful to anyone else in a similar position.
Changes
UnityWebRequestAwaiterExtension.mustache
CSharpClientCodegen.java
Validation
openapi-generator-cli
from source with changes-l csharp --library unityWebRequest
await request.SendWebRequest();
compiles and functions as expectedPR checklist
Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work.
Run the following to [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) and update samples:
File the PR against the correct branch:
master
(upcoming7.x.0
minor release - breaking changes with fallbacks)If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members:
@mandrean
@shibayan
@Blackclaws
@iBicha