wiretap icon indicating copy to clipboard operation
wiretap copied to clipboard

Wiretap shows violations when response object has string as null when the open API specifies nullable: true

Open mdiwakar opened this issue 1 year ago • 7 comments

145 | /allOf/1/properties/results/items/allOf/1/properties/speakerId/type | expected string, but got null -- | -- | --

mdiwakar avatar Feb 08 '24 22:02 mdiwakar

what was the version of the OAS spec ? because in recent version nullable : true is not supported , null beeing a definitive type

so sould be type : [string , null ]

more details here https://stackoverflow.com/questions/48111459/how-to-define-a-property-that-can-be-string-or-null-in-openapi-swagger#:~:text=OAS2%20does%20not%20support%20%27null%27%20as%20the%20data,are%20not%20part%20of%20the%20OpenAPI%202.0%20Specification.

LasneF avatar Feb 16 '24 13:02 LasneF

the version is version: 3.0.0

mdiwakar avatar Feb 17 '24 15:02 mdiwakar

any further updates on this issue?

mdiwakar avatar May 09 '24 14:05 mdiwakar

The problem here is that this schema validation is performed by a dependency, not wiretap, it's being handled by github.com/santhosh-tekuri/jsonschema/v5

Code is here: https://github.com/pb33f/libopenapi-validator/blob/main/schema_validation/validate_schema.go#L126

daveshanley avatar May 12 '24 17:05 daveshanley

should a ticket been raised ?

LasneF avatar May 13 '24 08:05 LasneF

Any update on supporting this? This blocks me from being able to adopt this tool. It looks like the dependency that is to blame is on v6.

collin-rogers avatar Sep 16 '24 19:09 collin-rogers

@daveshanley nullable is a mess introduced in 3.0 and removed in 3.1.0

the upgrade to the newest version https://github.com/santhosh-tekuri/jsonschema/releases/tag/v6.0.0

will not help as it is not related to json schema but to OAS directly

@mdiwakar i would advise you to upgrade to OAS 3.1 if you can, otherwise the fix is a oneOf only for version 3.0 here any contribution will be welcome

LasneF avatar Sep 16 '24 20:09 LasneF