Skip to content

fix OpenAPI nullability for Option<T> request and response bodies - #1751

Merged
sunshowers merged 5 commits into
sunshowers/spr/add-tests-showing-nullability-dropped-for-optiont-bodiesfrom
sunshowers/spr/fix-openapi-nullability-for-optiont-request-and-response-bodies
Oct 29, 2026
Merged

sunshowers merged 5 commits into
sunshowers/spr/add-tests-showing-nullability-dropped-for-optiont-bodiesfrom
sunshowers/spr/fix-openapi-nullability-for-optiont-request-and-response-bodies

Conversation

@sunshowers

@sunshowers sunshowers commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

See the comment for more details.

This was found while working on trust quorum for RFD 747. In omicron main, Sled
Agent's GET /trust-quorum/coordinator-status returns an
Option<CoordinatorStatus>
, but the corresponding OpenAPI
document
does not mark the return type as nullable.

@sunshowers
sunshowers changed the base branch from sunshowers/spr/main.fix-openapi-nullability-for-optiont-request-and-response-bodies to sunshowers/spr/add-tests-showing-nullability-dropped-for-optiont-bodies October 27, 2026 23:51
@sunshowers
sunshowers added this pull request to stack #1752 October 27, 2026 23:51
@sunshowers
sunshowers requested a review from ahl October 27, 2026 23:53

@ahl ahl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great catch and fix

reference: reference.clone(),
let reference =
openapiv3::ReferenceOr::Reference { reference: reference.clone() };
if schema_object_is_nullable(obj) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note that in this situation schemars should NOT be decorating a schema with extensions since it's not valid OpenAPI v3.0.x -- but it is.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep. Discussed privately in chat, and added a comment about this.

@sunshowers
sunshowers merged commit 881740c into main Oct 29, 2026
21 checks passed
@sunshowers
sunshowers deleted the sunshowers/spr/fix-openapi-nullability-for-optiont-request-and-response-bodies branch October 29, 2026 20:21
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.

2 participants