Repository navigation
add tests showing that nullability is dropped for Option<T> bodies - #1750
Merged
sunshowers merged 2 commits intoOct 29, 2026
Merged
sunshowers merged 2 commits into
sunshowers merged 2 commits into
Conversation
ahl
approved these changes
Oct 28, 2026
ahl
left a comment
Collaborator
There was a problem hiding this comment.
ok; are you going to squash these two PRs down or did you want each to land in main? Slight preference for the former, but up to you
Collaborator
Author
|
My plan was to land them separately. But I want to make sure our story re drift is straight before landing this stack, as discussed in chat |
ahl
reviewed
Oct 29, 2026
|
|
||
| // BUG: Currently, the fact that the type is nullable is dropped, | ||
| // leading to the same output as Foo below. | ||
| let schema = make_subschema_for::<Option<Foo>>(&mut generator); |
Collaborator
There was a problem hiding this comment.
FWIW, with SchemaSettings::openapiv3() one would expect the generated schema to be something like { allOf: [ { $ref: Foo }], nullable: true }, instead it seems to be:
{
"$ref": "Foo",
"nullable": true
}... which isn't a valid OppenAPI 3.0.x schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, on seeing an endpoint with request and/or response bodies of type
Option<CoolStruct>, Dropshot represents it in OpenAPI as a plain$reftoCoolStruct, with nullability dropped.These tests record the current, incorrect behavior. The next commit
fixes it.