Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect handling of non-nullable deepObject properties #293

Open
Tracked by #318
jharting opened this issue Jan 29, 2021 · 1 comment
Open
Tracked by #318

incorrect handling of non-nullable deepObject properties #293

jharting opened this issue Jan 29, 2021 · 1 comment
Labels

Comments

@jharting
Copy link

Consider the following schema:

---
openapi: 3.0.3
info:
  title: Reproducer
  version: 0.0.1

paths:
  /example:
    get:
      operationId: Example
      parameters:
      - in: query
        name: filter
        required: false
        style: deepObject
        explode: true
        schema:
          type: object
          properties:
            foo:
              type: string
            bar:
              type: string
          required: []

      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object

This let's one make a request like
/example?filter[foo]=abc&filter[bar]=def

However, the following request
/example?filter[foo]=abc

fails with
"Parameter 'filter' in query has an error: Error at \"/bar\": Value is not nullable"

This behavior is incorrect as neither of the filter properties is required. Instead of the nullability check, kin-openapi should check whether the property is actually required.

A quick workaround is to add nullable: true to filter's properties. However, that is semantically not correct. The property is not required (i.e. can be omitted) but is not nullable (i.e. it is not valid for it to be explicitly set to a null value).

@fenollp fenollp added the bug label Feb 4, 2021
@mahad-akhter
Copy link

My team is also facing this issue
Any progress to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants