Learning about REST APIs and am following https://apihandyman.io/writing-openapi-swagger-specification-tutorial-part-2-the-basics/.
The API can receive two parameters:
summary: Gets a person
description: Returns a single person for its username.
- name: username
description: The person's username
- name: bla
description: bla bla bla
description: A Person
description: The Person does not exists.
Your interpretation is correct. If a property of a response object is listed in the
required property list, is must be present in the response object for it to be valid, quite similar to the
required field in a parameter object. Whether a non-required property is included in the response or not is up to the business logic of your application to decide.
Some more information with pointers to the relevant parts of the specification below:
The semantics of the
required property list of a response object is defined as part of the Schema Object section of the OpenAPI specification. There it says that the schema object "is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it".
In the corresponding section on the
required validation keyword of the JSON Schema Validation specification its semantics is defined as follows:
126.96.36.199. Valid values
The value of this keyword MUST be an array. This array MUST have at least one element. Elements of this array MUST be strings, and MUST be unique.
188.8.131.52. Conditions for successful validation
An object instance is valid against this keyword if its property set contains all elements in this keyword's array value.