Skip to content

Commit

Permalink
Add null check for instances of missing schema
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelkanda committed Oct 26, 2023
1 parent 1cbd8eb commit fa340f8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ internal static DeprecationInformation GetDeprecationInformation(this OpenApiOpe
return deprecatedValue.ToDeprecationInformation();
else if (operation.Responses.Values
.SelectMany(static x => x.Content.Values)
.Select(static x => x.Schema)
.Select(static x => x?.Schema)
.Where(static x => x != null && !x.IsReferencedSchema())
.Select(static x => x.GetDeprecationInformation())
.Select(static x => x!.GetDeprecationInformation())
.FirstOrDefault(static x => x.IsDeprecated) is DeprecationInformation responseDeprecationInformation)
return responseDeprecationInformation;
else if (operation.RequestBody?.Content.Values
.Select(static x => x.Schema)
.Select(static x => x?.Schema)
.Where(static x => x != null && !x.IsReferencedSchema())
.Select(static x => x.GetDeprecationInformation())
.Select(static x => x!.GetDeprecationInformation())
.FirstOrDefault(static x => x.IsDeprecated) is DeprecationInformation requestDeprecationInformation)
return requestDeprecationInformation;
return new(null, null, null, null, operation.Deprecated);
Expand Down

0 comments on commit fa340f8

Please sign in to comment.