swagger-php icon indicating copy to clipboard operation
swagger-php copied to clipboard

How do I specify not > required items?

Open abarker-gravity opened this issue 5 months ago • 2 comments

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"
     *                 }
     *             )
     *
     *     )
     *   ),

abarker-gravity avatar Sep 03 '24 21:09 abarker-gravity