-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Labels
kind/bugFeature doesn't work as expected.Feature doesn't work as expected.status/triageCollecting information required to triage the issue.Collecting information required to triage the issue.
Description
Description
The code generator skips anyOf
or oneOf
that have nullable listed:
warning: Schema "null" is not supported, reason: "schema type", skipping [context: foundIn=Operations.OperationName.Output.Ok.Body.JsonPayload.DataPayloadPayload (#/paths/path/to/resource/GET/responses/200/content/json/DataPayload)/my_type]
Reproduction
"my_type": {
"anyOf": [
{
"$ref": "#/components/schemas/MyType"
},
{
"type": "null"
}
]
}
"my_type": {
"oneOf": [
{
"$ref": "#/components/schemas/MyType"
},
{
"type": "null"
}
]
}
Package version(s)

Expected behavior
ideally it should produce an optional. But an enum would also work.
Environment
swift 6.2
Xcode 26.0 beta 6
Additional information
The only workaround I've found is to do something like this, but the library our back end is using to produce the openapi spec does not seem to support something like this:
"my_type": {
"$ref": "#/components/schemas/MyType",
"type": ["object", "null"]
},
Metadata
Metadata
Assignees
Labels
kind/bugFeature doesn't work as expected.Feature doesn't work as expected.status/triageCollecting information required to triage the issue.Collecting information required to triage the issue.