Skip to content

Commit b7b845c

Browse files
Update src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
1 parent f13a9e4 commit b7b845c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public IEnumerable<IOpenApiParameter> ConvertToFormDataParameters(IOpenApiWriter
137137
OpenApiSchema s => s, // we already have a copy
138138
// we have a copy of a reference but don't want to mutate the source schema
139139
// TODO might need recursive resolution of references here
140-
OpenApiSchemaReference r => (OpenApiSchema?)r.Target?.CreateShallowCopy(),
140+
OpenApiSchemaReference r when r.Target is not null => (OpenApiSchema)r.Target.CreateShallowCopy(),
141+
OpenApiSchemaReference r2 when r.Target is null => throw new InvalidOperationException("Unresolved reference target"),
141142
_ => throw new InvalidOperationException("Unexpected schema type")
142143
};
143144
if (updatedSchema is not null)

0 commit comments

Comments
 (0)