Add support for 'null' values in response.
In a nutshell, my model requires having 'null' values for some field in certain cases. Currently I get following error on such fields:
[ERROR] [Path '/data/0/workflow_instance/14/task_instance/2/actual_start_time'] Instance type (null) does not match any allowed primitive type (allowed: ["integer"])
I found no way to overcome this.
As a solution I see either supporting one of the 'x-nullable' kind of attributes in spec file (Please see https://github.com/OAI/OpenAPI-Specification/issues/229 for details, search for "x-nullable") or adding some setting to Validator to allow me decide if it should ignore all null values at once.
Thank you in advance. Alex.
Comments (5)
-
-
Actually - I think I may have found it.
The null cleanup code that is used in the schema validator doesn't traverse arrays properly - I can reproduce your error message if I have
null
s in arrays, or in objects in arrays.Looking at the path in your example error msg I'd say thats what the problem is.
-
- changed status to open
-
- changed status to resolved
Available in v1.0.13
-
@jnavin I have the "same" issue, but for oneOf and allOf operators. I just created https://bitbucket.org/atlassian/swagger-request-validator/issues/178/does-oneofvalidator-support-nullable with a proper explanation.
- Log in to comment
Hi Alex,
Im having trouble reproducing this problem.
Would it be possible for you to provide an example Swagger spec and request that causes the problem?
Thanks!