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

updated unmarshaling logic #244

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

maurafortino
Copy link
Contributor

@maurafortino maurafortino commented Aug 23, 2024

What's Included:

  • update to the ItemToInternalWebhook logic
  • RegistryV2 was being unmarshaled into RegistryV1 due to having a handful of the same field names
  • Checking canonical_name in v2 as it's not in v1 and it is a required field for V2

@maurafortino maurafortino self-assigned this Aug 23, 2024
Copy link
Contributor

@denopink denopink left a comment

Choose a reason for hiding this comment

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

@maurafortino
Copy link
Contributor Author

maybe we can simplify this by using https://pkg.go.dev/encoding/json#Decoder.DisallowUnknownFields ?

@denopink

i thought about using decoder but then found this article: https://dev.to/taqkarim/you-might-not-be-using-json-decoder-correctly-in-golang-12mb

if you're okay with the approach that shows how the decoder should be used I can move forward with that solution.

@denopink
Copy link
Contributor

maybe we can simplify this by using https://pkg.go.dev/encoding/json#Decoder.DisallowUnknownFields ?

@denopink

i thought about using decoder but then found this article: https://dev.to/taqkarim/you-might-not-be-using-json-decoder-correctly-in-golang-12mb

if you're okay with the approach that shows how the decoder should be used I can move forward with that solution.

@maurafortino I like that article but I think the context is bit different (we can chat about it further if you want me to expand on that). I think using DisallowUnknownFields will keep the code cleaner and simpler imo.

Copy link
Contributor

@denopink denopink left a comment

Choose a reason for hiding this comment

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

other than adding back the newline on line 89, lgtm!

note: we're going to come back to this at a later date.

@maurafortino maurafortino merged commit b3ef5de into feat/webhook-update Aug 29, 2024
14 checks passed
@maurafortino maurafortino deleted the fix/itemToInternalWebhook branch August 29, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants