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

generate input objects, start using Nullable #498

Merged
merged 17 commits into from
Jan 3, 2025
Merged

Conversation

davidbloss
Copy link
Contributor

@davidbloss davidbloss commented Dec 26, 2024

Resolves #573

🚨 This PR contains BREAKING CHANGES for the upcoming v2025 opslevel-go release 🚨

Run task gen to see new code generated in input.go

Noteworthy Changes

  • ❗The *Nullable[<type>] type now wraps optional fields of most structs in input.go. This sweeping change enables setting input object fields to JSON null, resolves ambiguity during API update calls, and completes a planned major refactor before the next major release of opslevel-go.
  • In scalar.go, a new UnmarshalJSON() for Nullable types was added to correctly unmarshal JSON values to this custom type.
  • task gen now uses the template in templates/inputObjects.tpl to generate everything in input.go
  • In gen.go: enumExamples, listExamples, and scalarExamples are used to set values in example: struct tags
  • All RefOf() calls have been replaced with NewNullableFrom()
  • Tests have been updated that verify these changes.

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Does this change require a Terraform schema change?
    • If so what is the ticket or PR #
  • Make a changie entry that explains the customer facing outcome of this change

@davidbloss davidbloss self-assigned this Dec 26, 2024
@davidbloss davidbloss marked this pull request as ready for review December 27, 2024 16:42
@davidbloss davidbloss changed the title WIP: generate input objects, start using Nullable generate input objects, start using Nullable Dec 27, 2024
actions_test.go Outdated Show resolved Hide resolved
gen.go Outdated Show resolved Hide resolved
gen.go Outdated Show resolved Hide resolved
gen.go Outdated Show resolved Hide resolved
input.go Outdated Show resolved Hide resolved
input.go Outdated Show resolved Hide resolved
input.go Outdated Show resolved Hide resolved
actions.go Outdated Show resolved Hide resolved
check_test.go Outdated Show resolved Hide resolved
check_test.go Outdated Show resolved Hide resolved
actions_test.go Outdated Show resolved Hide resolved
common.go Outdated Show resolved Hide resolved
check_test.go Outdated
@@ -32,8 +32,9 @@ var (
Value: ol.RefOf("Requests"),
}

equalsEnum = ol.PredicateTypeEnumEquals
Copy link
Collaborator

Choose a reason for hiding this comment

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

missed?

input.go Show resolved Hide resolved
input.go Show resolved Hide resolved
input.go Show resolved Hide resolved
check_test.go Outdated Show resolved Hide resolved
check_test.go Outdated Show resolved Hide resolved
check_test.go Outdated Show resolved Hide resolved
scalar_test.go Outdated Show resolved Hide resolved
tags.go Show resolved Hide resolved
user_test.go Outdated Show resolved Hide resolved
user_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@rocktavious rocktavious left a comment

Choose a reason for hiding this comment

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

🚀

@davidbloss davidbloss merged commit 8e0a557 into main Jan 3, 2025
1 of 3 checks passed
@davidbloss davidbloss deleted the db/gen-input-objects branch January 3, 2025 21:18
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