OpenAPI-Specification icon indicating copy to clipboard operation
OpenAPI-Specification copied to clipboard

Can not convert Array to Boolean

Open ntregillus opened this issue 9 years ago • 4 comments

I am attempting to use a JSON schema to POCO converter, and I am receiving the following error when loading the https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v2.0/schema.json file.

I have attempted a number of tools to build there objects in C# but they all throw a similar error. unfortunately none of the tools specify what Array is attempting to be converted to Boolean.

is there a typo here?

ntregillus avatar Jul 26 '17 20:07 ntregillus

Hi @ntregillus , make sure you are using tooling for JSON Schema Draft 4 (not 3) for this schema. We are using this schema with a Java JSON schema tolling without any problems.

This schema follows JSON Schema Draft 4 (http://json-schema.org/draft-04/schema#) rules. Is it possible that your C# tooling is trying to parsing it using JSON Schema Draft 3 (not 4) rules?

In Draft 3, the valueof required attribute should be boolean, while in Draft 4 it's an array, like here :

     "required": [
       "version",
       "title"
     ],

Using JSON Schema v3 parser could create an error like yours:

Array is attempting to be converted to Boolean

tfesenko avatar Jul 26 '17 20:07 tfesenko

@ntregillus Out of curiosity, what do you want to do with the POCOs of the OpenAPI spec.

darrelmiller avatar Jul 27 '17 14:07 darrelmiller

interesting.... I'll see what version i should use.... i was trying to build the schema with newton soft's toolset...

ntregillus avatar Jul 31 '17 20:07 ntregillus

If there's anything else to do for this, it seems to be a JSON Schema tooling issue and not an OpenAPI Specification issue. Closing.

handrews avatar Jan 27 '24 02:01 handrews