oxidecomputer / oxidecomputer/oxide.go

Remove `exceptions.go`

Open
#351 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement Go SDK
Dominant language
Go
Stars
26
Forks
6
Avg merge
5h 33m
Merged PRs (30d)
9

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading internal/generate/exceptions.go and the context in pull request #289, then review the OpenAPI-driven codegen behavior described in the issue. Determine which exceptions can be removed and whether the remaining hints require consistent Nexus API behavior or OpenAPI extensions. Done means exceptions.go is no longer needed and the SDK generation behavior is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.