Getting strange UnrecognizedKwargsError error

Same thing also happened to me;

So this was the initial openapi that doesn’t work and returns UnrecognizedKwargsError: requestArgs

"/api/v1/me/example": {
  "post": {
    "summary": "Just a redacted example",
    "operationId": "executeExample",
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "recordIdOrSlug"
            ],
            "properties": {
              "idOrSlug": {
                "oneOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "description": "The ID of the record to find. In UUID format.",
                    "examples": [
                      "090abc6e-0e19-466d-8549-83dd24c5c8e5"
                    ]
                  },
                  {
                    "type": "string",
                    "description": "The slug of the record to run.",
                    "examples": [
                      "myRecord"
                    ]
                  }
                ]
              },
              "requestArgs": {
                "type": "object",
                "description": "The request arguments to pass to the record in a form of an object.",
                "additionalProperties": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "Successfully ran the record",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiSuccess"
            }
          }
        }
      },
      "400": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    }
  }
},

Tried updating requestArgs as following, but no success.

"requestArgs": {
  "type": "object",
  "description": "The request arguments to pass to the record in a form of an object.",
  "additionalProperties": true
}

Multiple attempts after, tried with this;

"requestArgs": {
  "type": "object",
  "description": "The request arguments to pass to the record in a form of an object.",
  "properties": {},
  "additionalProperties": true
}

And it started working. Weird…

1 Like

This solved my issue, thank you a million. It seems if you define a type as an object it must have a properties field, even if its just an empty dictionary value.

  "properties": {},

Otherwise you will get the UnrecognizedKwargsError

1 Like

Hi, do you have an example?
thanks a lot

I am new to openapi schema, so your assistance would be greatly appreciated.

I have tried multiple of the suggestions here, but I am getting the UnrecognizedKwargsError error only when certain data is being past. Specifically Numbers as the Key.

For example when It pass:

  "params": {
    "entry_id": "60",
    "form_id": "77",
    "date_updated": "2025-01-29 22:28:33",
    "is_starred": "0",
    "created_by": 1,
    "source_url": "https://domain.com/?gf_page=preview&id=77",
    "ip": "10.0.0.1",
    "date_created": "2025-01-29 23:46:02",
    "is_read": "1",
    "user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/120.0", 
    "status": "active"
  }

It passes the info correctly to my endpoint, but when it passes:

  "params": {
    "2": "greg@domain.com",
    "3": "(123) 456-7890",
    "4": "12345",
    "13": "10.0.0.1",
    "entry_id": "60",
    "form_id": "77",
    "date_updated": "2025-01-29 22:28:33",
    "is_starred": "0",
    "created_by": 1,
    "source_url": "https://domain.com/?id=77",
    "ip": "10.0.0.1",
    "date_created": "2025-01-29 23:46:02",
    "is_read": "1",
    "user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/120.0",
    "status": "active",
    "1.3": "Greg",
    "1.6": "test"
  }

It fails with the following error: "UnrecognizedKwargsError: (‘4’, ‘1.3’, ‘1.6’, ‘2’, ‘3’, ‘13’, ‘21’, ‘22’)

It seems like there might be an issue with numbers as strings as the key. I need to be able to pass those numbers as the keys.

Since these numbers are not static for each request, I can hardcode them into the schema. So I have tried adding different versions of “patternProperties” and “additionalProperties”

I have tried" additionalProperties: true and

      additionalProperties:
        oneOf:
          - type: string
            description: Dynamic field values for the entry. Keys may be numbers (e.g., `"4"`) or decimals (e.g., `"1.3"`).
          - type: integer
            description: Numeric field values.

I have tried:

      patternProperties:
        "^[0-9]+(\\.[0-9]+)?$":  # Matches numeric keys like "4" or "1.3"
          type: string
          description: Dynamic field values identified by field numbers.

But none of those helped.

Here is my base openapi 3.1.0 scheme that works and fails as described above:

openapi: 3.1.0
info:
  title: Gravity Forms Entry Update
  description: An action to update a specific Gravity Forms entry using the `/gf/v2/entries/{entry_id}` endpoint.
  version: 1.0.0
servers:
  - url: https://domain.com
    description: Gravity Forms API Server
paths:
  /wp-json/gf/v2/entries/{entry_id}:
    put:
      operationId: updateEntry
      summary: Update an Entry
      description: Updates a specific entry. Values not provided will be blanked out.
      parameters:
        - name: entry_id
          in: path
          required: true
          description: The ID of the entry to be updated.
          schema:
            type: string
      requestBody:
        description: Entry object with properties to update.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: The entry ID.
                form_id:
                  type: string
                  description: The form ID.
                date_updated:
                  type: string
                  format: date-time
                  description: The date the entry was last updated.
                is_starred:
                  type: string
                  description: Whether the entry is starred (0 or 1).
                created_by:
                  type: integer
                  description: The user ID of the entry creator.
                source_url:
                  type: string
                  format: uri
                  description: The URL where the form was embedded.
                ip:
                  type: string
                  description: The IP address of the entry creator.
                date_created:
                  type: string
                  format: date-time
                  description: The date the entry was created.
                is_read:
                  type: string
                  description: Whether the entry has been read (0 or 1).
                user_agent:
                  type: string
                  description: The user agent string for the browser used to submit the entry.
                status:
                  type: string
                  description: The status of the entry.
                payment_amount:
                  type: string
                  description: The amount of the payment.
                payment_date:
                  type: string
                  format: date
                  description: The date of the payment.
                payment_method:
                  type: string
                  description: The payment method for the payment.
                payment_status:
                  type: string
                  description: The status of the payment.
                transaction_id:
                  type: string
                  description: The transaction ID for the payment.
                transaction_type:
                  type: string
                  description: The type of transaction.
              additionalProperties: true
      responses:
        "200":
          description: Entry updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID of the updated entry
                  status:
                    type: string
                    description: Updated status of the entry
                  updated_fields:
                    type: object
                    description: Fields that were updated
                    additionalProperties: true
        "400":
          description: Invalid request or data
        "401":
          description: Unauthorized or missing/invalid token
        "404":
          description: No matching entry found
        "500":
          description: Server error

What am I missing? or is this a bug?

Thanks