Skip to content

Fix managed database update decoding#56

Open
rowillia-akamai wants to merge 2 commits intolinode:mainfrom
rowillia-akamai:rowillia/fix-managed-databases
Open

Fix managed database update decoding#56
rowillia-akamai wants to merge 2 commits intolinode:mainfrom
rowillia-akamai:rowillia/fix-managed-databases

Conversation

@rowillia-akamai
Copy link
Copy Markdown

@rowillia-akamai rowillia-akamai commented Apr 20, 2026

Description of your changes

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.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

Stacked on #57

How has this code been tested

@rowillia-akamai rowillia-akamai force-pushed the rowillia/fix-managed-databases branch from 00fa188 to e38cdbf Compare April 20, 2026 16:23
@rowillia-akamai rowillia-akamai changed the title Rowillia/fix managed databases Fix managed database update decoding Apr 20, 2026
rowillia-akamai and others added 2 commits April 21, 2026 09:53
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>
@rowillia-akamai rowillia-akamai force-pushed the rowillia/fix-managed-databases branch from e38cdbf to 63b1f9c Compare April 21, 2026 08:55
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.

1 participant