Skip to content
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

Default APIVersion and Kind for objects #146

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

scothis
Copy link
Collaborator

@scothis scothis commented Jun 10, 2024

Setting the APIVersion and Kind isn't necessary for typed objects, it is essential for unstructured objects. Set the default values on object dies by calling d.DieDefaultTypeMeta(). This behavior is opt-in to avoid mass changes to existing objects.

Signed-off-by: Scott Andrews <scott@andrews.me>
@@ -477,9 +477,6 @@ func (c *copyMethodMaker) generateJSONMethodsFor(die Die) {

c.Linef("")
c.Linef("func (d *%s) UnmarshalJSON(b []byte) error {", die.Type)
c.Linef(" if d == %s {", die.Blank)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this check because the blank is always immutable. Even in this case, the retained message below is better because a copy of an immutable die is still immutable.

@scothis scothis merged commit 65f57ab into reconcilerio:main Jun 11, 2024
2 checks passed
@scothis scothis deleted the apiversion-kind branch June 11, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants