Order YAML type meta fields before resource data#1717
Conversation
Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
|
@copilot Fix pipelines |
Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Fixed the pipeline StyleCop SA1513 issue by adding the required blank line in KubernetesYaml.cs. Commit: 38a5ce3. No UI changes. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #1715 by implementing property ordering for Kubernetes YAML serialization, ensuring TypeMeta fields (apiVersion, kind, metadata) appear before resource-specific data fields. This matches the behavior of the Kubernetes Go client's CLI runtime printer.
Changes:
- Modified
WithOverridesFromJsonPropertyAttributesto assign explicit order values to properties in types with ApiVersion/Kind fields - Updated existing tests to expect the new property ordering
- Added new test
WriteConfigMapOrdersTypeMetaFirstto explicitly verify the ordering behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/KubernetesClient/KubernetesYaml.cs | Implements property ordering logic using YamlMemberAttribute.Order for types with ApiVersion/Kind, ensuring TypeMeta fields (ApiVersion, Kind, Metadata) are serialized first, followed by other properties in metadata token order |
| tests/KubernetesClient.Tests/KubernetesYamlTests.cs | Updates WriteSecret and WriteConfigMap test expectations to match new property ordering, and adds WriteConfigMapOrdersTypeMetaFirst test to verify the feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Copilot, tg123 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.