oxidecomputer / oxidecomputer/omicron
[nexus] OpenAPI schema not marking required query params required
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
The selector struct (correct)
InternetGatewaySelector selects a gateway. It correctly has a required gateway field and optional project and vpc, representing the possibility of selecting by gateway ID, in which case neither of the parent identifiers can be included.
The endpoints
These two endpoints use InternetGatewaySelector as their query params to select a gateway. The fact that
The OpenAPI schema (wrong)
The gateway query param is optional, but it should not be.
The TypeScript type generated accordingly
https://github.com/oxidecomputer/console/blob/653b572/app/api/__generated__/Api.ts#L4541-L4548
export interface InternetGatewayIpPoolListQueryParams {
gateway?: NameOrId
limit?: number
pageToken?: string
project?: NameOrId
sortBy?: NameOrIdSortMode
vpc?: NameOrId
}
What a required query param looks like
An unrelated endpoint with the same issue
This suggests it might have something to do with nesting it in the pagination thing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the InternetGatewaySelector definition in nexus/types/src/external_api/params.rs and the two endpoint definitions in nexus/external-api/src/lib.rs. Compare their entries in openapi/nexus.json with the required-query-parameter example, then inspect the unrelated paginated endpoint for the shared schema-generation pattern. Done means the gateway parameter is marked required in both schemas and the generated TypeScript type reflects that.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100