Skip to content

Add missing fields to network types #278

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

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

internet-diglett
Copy link
Contributor

No description provided.

@internet-diglett internet-diglett marked this pull request as draft April 11, 2025 21:25
internet-diglett added a commit to oxidecomputer/omicron that referenced this pull request May 31, 2025
This PR aims to improve the usability of the switch port settings API by
returning data of similar shape and content as what users provide when
the create the switch port settings.

Issues resolved:
* Before this PR, you only need one call to create a complete switch
port settings object, but you have to perform several lookups to get the
complete switch port configuration. We were already returning the object
ids of the nested objects, so it makes a lot of sense to just return the
actual object (especially since the user supplied the entire object when
they configured it)
* The `HashMap<String_of_link_name, T>` pattern also did not give the
expected behavior in our go client generation. Changing this to a
`Vec<T_with_link_name_inside>` matches what the user provides during
creation and also resolves this behavior.
* Some of our `Vec<T>` fields can be empty but must be present. In the
Go client, an empty array is omitted from the json object. We needed to
add a `default` annotation to these fields so Serde handles this
situation correctly.

## Related
- oxidecomputer/oxide.go#278
- oxidecomputer/terraform-provider-oxide#426

Closes #5780
hawkw pushed a commit to oxidecomputer/omicron that referenced this pull request Jun 2, 2025
This PR aims to improve the usability of the switch port settings API by
returning data of similar shape and content as what users provide when
the create the switch port settings.

Issues resolved:
* Before this PR, you only need one call to create a complete switch
port settings object, but you have to perform several lookups to get the
complete switch port configuration. We were already returning the object
ids of the nested objects, so it makes a lot of sense to just return the
actual object (especially since the user supplied the entire object when
they configured it)
* The `HashMap<String_of_link_name, T>` pattern also did not give the
expected behavior in our go client generation. Changing this to a
`Vec<T_with_link_name_inside>` matches what the user provides during
creation and also resolves this behavior.
* Some of our `Vec<T>` fields can be empty but must be present. In the
Go client, an empty array is omitted from the json object. We needed to
add a `default` annotation to these fields so Serde handles this
situation correctly.

## Related
- oxidecomputer/oxide.go#278
- oxidecomputer/terraform-provider-oxide#426

Closes #5780
@sudomateo sudomateo self-requested a review June 26, 2025 20:15
Copy link
Collaborator

@sudomateo sudomateo left a comment

Choose a reason for hiding this comment

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

Do I have it correct that the only changes you need for the related oxidecomputer/terraform-provider-oxide#426 are the exceptions for the 3 types added in internal/generate/exceptions.go or are you making use of any of the new code generated in oxide/paths.go?

@karencfv
Copy link
Collaborator

I think there were a lot of things generated because of the change that was made to the API tags on omicron. That was handled and fixed in #298. This PR probably just needs to rebase/merge with main, and a whole bunch of paths should just go away.

#298 is also based on a newer commit, so we definitely want to use the omicron version there.

@sudomateo sudomateo force-pushed the add-missing-fields-to-network-types branch from 79551d4 to 86e49ef Compare June 26, 2025 23:06
@sudomateo sudomateo marked this pull request as ready for review June 26, 2025 23:07
@sudomateo
Copy link
Collaborator

I squashed the commits and rebased from main with the necessary changes. Should be good now!

Added network types to the nullable exception.

Co-authored-by: Levon Tarver <11586085+internet-diglett@users.noreply.github.com>
@sudomateo sudomateo force-pushed the add-missing-fields-to-network-types branch from 86e49ef to 8c8ed85 Compare June 26, 2025 23:13
Copy link
Collaborator

@karencfv karencfv left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@sudomateo sudomateo merged commit a289a27 into main Jun 26, 2025
1 check passed
@sudomateo sudomateo deleted the add-missing-fields-to-network-types branch June 26, 2025 23:31
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.

3 participants