Skip to content

Remove exceptions.go #351

@jmcarp

Description

@jmcarp

In most cases, our codegen logic derives go types, methods, etc. purely from the openapi spec. However, in a few cases, we need to provide hints to change the default behavior, captured in https://github.com/oxidecomputer/oxide.go/blob/main/internal/generate/exceptions.go. We should gradually remove cases from this file and eventually drop it entirely. Instead, we can either change the nexus api to behave consistently, or expose openapi extensions from nexus to provide codegen hints in exceptional cases. This will allow nexus to control how the sdk is generated, rather than building hidden knowledge about nexus into the codegen logic here.

By the way, I was looking at exceptions.go and didn't fully understand the overrides we've defined there. For example, we configure a few specific types to serialize using omitzero rather than the default omitempty. We said in the PR description that the goal was to serialize empty slices of those types to [] instead of omitting, but I think changing from omitempty to omitzero actually has the opposite effect. @sudomateo do you have context for that change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions