-
Notifications
You must be signed in to change notification settings - Fork 305
Fix up YAML serialisation to understand AutoRest property renaming #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix up YAML serialisation to understand AutoRest property renaming #209
Conversation
Don't merge this yet - we might be able to bypass this runtime fixup by changing our AutoRest config to emit YamlMemberAttribute. I'll look into this. |
it is tough to modify autorest generator, I think. |
@tg123 Yeah... I have been looking through the generation scripts and I can see where we do some
into
The relevant post-processing is around https://github.com/kubernetes-client/gen/blob/087e4b4d9b4e40973a24f848b47f0dacc08e9160/openapi/csharp.sh#L62. My sed-fu is rusty but I think it bears investigating... |
Let's give up on the AutoRest config approach for now, and go with this. Please review @brendandburns @tg123 - thanks! CI failure looks like the known certificate test flake. |
/lgtm @itowlson can we get a rebase? I fixed (well, commented out) that test :) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, itowlson The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@fearthecowboy may be interested in this feedback. |
AutoRest renames properties such as 'namespace' and 'readOnly' to avoid clashes with keywords in common .NET languages. It uses
JsonPropertyAttribute
to map these back to the right names in JSON. However, the YAML serialiser isn't aware of the JSON mappings, so loading YAML including such properties fails (similarly, writing them out produces the wrong YAML text). This PR adds a custom type inspector to the YAML serialisation stack which performs the additional mapping needed.Fixes #208.