swagger-php
swagger-php copied to clipboard
How do I specify not > required items?
I am trying to generate the following OpenAPI JSON but I am having trouble generating the "not": { "required": [
array. I can't really find any examples of doing this and the only thing I can get working is producing warnings (PHP Warning: @OA\Schema() is missing key-field: "schema") because I'm likely doing it wrong. Any help would be appreciated.
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/User"
},
{
"minProperties": 1
}
],
"not": {
"required": [
"userId",
"userPubId"
]
}
}
}
}
},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* allOf={
* @OA\Schema(ref="#/components/schemas/User"),
* @OA\Schema(minProperties=1)
* },
* not=@OA\Schema(
* required={
* "userId",
* "userPubId"
* }
* )
*
* )
* ),