Closed lewisnyman closed 6 years ago
Hello. Hmm yeah I can see how that could trip you up.
The presence of required on a property is because it is a type of schema object as per: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schema-object and it's presence only really becomes relevant when you're dealing with a type of object. So it's not actually intended to show whether that property is required in the parent schema context but to show what properties are required in it's own context.
e.g.
NewPet:
required:
- name
properties:
name:
type: object
required:
- last_name
properties:
first_name:
type: string
last_name:
type: string
Oh of course! It's a schema object within a schema object. Thanks for the guidance. Looks like the best thing to do is to write a helper method.
Hello, With a schema like this:
When I access the
name
property, required returns nil. I can write a helper function that checks the required array, it would be useful to set required for properties as it exists.