cancel
Showing results for 
Search instead for 
Did you mean: 
Welcome to the September Hub-bub

We are inviting you to join our exciting online event where you can learn a lot of useful information, share your knowledge and have fun. Each week, we will reward the best posters with free gift cards .

Just pick any topic you like in the SwaggerHub Community, or create your own to dive into the wonderful September Hub-bub.

Event duration: September 2-27. More information.

This Week Top Contributors:

We will decide the winners next Monday

json schema validation of null values

SOLVED
Highlighted
Occasional Contributor

json schema validation of null values

In reviewing the OPENAPI 3.0 specification at https://swagger.io/docs/specification/data-models/data-types/

null is not allowed as a type value, instead "the nullable attribute is used as a modifier of the base type", yet the current json schema validation specification https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1 knows nothing about this nullable attribute, but does support "null" as a valid type.  Given schema definitions in swagger can be used for schema validations and the specifications contradict each other, are there any plans to allow "null" as a valid type for backward compatibility?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: json schema validation of null values

OpenAPI 3 doesn't use JSON Schema directly, but uses an "extended subset of JSON Schema". As such, some difference exist, and the behavior of 'null' and 'nullable' is an example for that. Also, OAS3 is not based on the latest JSON Schema, but an older draft version (that's known as 00 or 05).

 

Any changes to the specification are driven by the OpenAPI Initiative and not SmartBear. You can check the work around it at https://github.com/OAI/OpenAPI-Specification/.

1 REPLY 1
Moderator

Re: json schema validation of null values

OpenAPI 3 doesn't use JSON Schema directly, but uses an "extended subset of JSON Schema". As such, some difference exist, and the behavior of 'null' and 'nullable' is an example for that. Also, OAS3 is not based on the latest JSON Schema, but an older draft version (that's known as 00 or 05).

 

Any changes to the specification are driven by the OpenAPI Initiative and not SmartBear. You can check the work around it at https://github.com/OAI/OpenAPI-Specification/.

New Here?
Join us and watch the welcome video:
SeptemberNews
Join the September Hub-bub to show off, learn and win