kin-openapi
kin-openapi copied to clipboard
incorrect handling of non-nullable deepObject properties
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).
My team is also facing this issue Any progress to fix this?