Fix managed database update decoding#56
Open
rowillia-akamai wants to merge 2 commits intolinode:mainfrom
Open
Conversation
00fa188 to
e38cdbf
Compare
The updates field in the v2 database resources was being overridden with schema.TypeMap, causing upjet to generate map[string]string. The Linode API returns an object with numeric fields (day_of_week, duration, hour_of_day) and a string field (frequency), which caused JSON deserialization to fail with: ReadString: expects " or n, but found 3 Fix by replacing the TypeMap override with a proper TypeList/MaxItems:1 schema that maps each field to its correct type (TypeFloat for numeric fields, TypeString for frequency). This allows upjet to generate typed structs (PostgreSQLv2UpdatesParameters, MySQLv2UpdatesParameters) with *float64 and *string fields that correctly unmarshal the API response. Also upgrades golang.org/x/tools to v0.43.0 to fix a build incompatibility with Go 1.25. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e38cdbf to
63b1f9c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
The updates field in the v2 database resources was being overridden with
schema.TypeMap, causing upjet to generatemap[string]string. The Linode API returns an object with numeric fields (day_of_week,duration,hour_of_day) and a string field (frequency), which caused JSON deserialization to fail with:Fix by replacing the
TypeMapoverride with a properTypeList/MaxItems:1schema that maps each field to its correct type (TypeFloatfor numeric fields,TypeStringfor frequency). This allows upjet to generate typed structs (PostgreSQLv2UpdatesParameters,MySQLv2UpdatesParameters) with*float64and `*string fields that correctly unmarshal the API response.I have:
make reviewable testto ensure this PR is ready for review.Stacked on #57
How has this code been tested