Skip to content

Commit

Permalink
Fix crash when "required" is not an array in OpenAPI schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Mar 28, 2024
1 parent 14012d9 commit b920f19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-openapi/src/OpenAPISchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ function getSchemaProperties(schema: OpenAPIV3.SchemaObject): null | OpenAPISche

result.push({
propertyName,
required: schema.required?.includes(propertyName),
required: Array.isArray(schema.required)
? schema.required.includes(propertyName)
: undefined,
schema: propertySchema,
});
});
Expand Down

0 comments on commit b920f19

Please sign in to comment.