DeepObject Parameter Causes Exceptions

Issue #230 resolved
Alex Stevens created an issue

OpenAPI spec:

openapi: 3.0.0
info:
  title: Customer Service - demonstrating a request validation
  version: 1.0.0
paths:
  /customers:
    get:
      summary: Retrieves a single customer's data
      parameters:
      - name: filter
        in: query
        description: Optional filter string, adhering to JSON:API spec
        required: false
        style: deepObject
        allowReserved: true
        explode: true
        schema:
          type: object
          properties:
            name_eq:
              type: string
            name_le:
              type: string
            name_ge:
              type: string
            name_lt:
              type: string
            name_gt:
              type: string
            name_ne:
              type: string
            name_lk:
              type: string
            name_nk:
              type: string
            name_nl:
              type: integer
              enum:
              - 1
              - 0      
      responses:
        '200':
          description: The matching customer data
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/getCustomer'

And when calling GET http://localhost:8080/customers?filter[name_eq]=customer1&filter[name_le]=customer2 the following is thrown:

{
    "messages": [
        {
            "key": "validation.request.parameter.query.unexpected",
            "level": "ERROR",
            "message": "Query parameter 'filter[name_eq]' is unexpected on path \"/customers\"",
            "context": {
                "requestPath": "/customers",
                "parameter": {
                    "name": "filter[name_eq]",
                    "in": "query"
                },
                "location": "REQUEST",
                "requestMethod": "GET"
            }
        },
        {
            "key": "validation.request.parameter.query.unexpected",
            "level": "ERROR",
            "message": "Query parameter 'filter[name_le]' is unexpected on path \"/customers\"",
            "context": {
                "requestPath": "/customers",
                "parameter": {
                    "name": "filter[name_le]",
                    "in": "query"
                },
                "location": "REQUEST",
                "requestMethod": "GET"
            }
        }
    ]
}

Is deepObject schema supported?

Thanks

Comments (2)

  1. James Navin

    Basic support for deep object params is available as of v2.8.0

    I will close this issue as resolved - please feel free to reopen if the current support doesn’t meet your needs.

  2. Log in to comment