krg7880 / json-schema-generator

Generates draft v4 schema from a local file or a remote JSON url.
MIT License
174 stars 53 forks source link

Mocha/Chai deep.equal fails when validating #19

Open IoT-master opened 7 years ago

IoT-master commented 7 years ago

I am using your json schema to validate two endpoints/responses, and I am having trouble using a working validator. The only one that works well, and with complex JSON is the deep.equal in Mocha/Chai.

The issue occurs when the required field appears with an array and not consistently in the same order, which deep.equal flags as a fail. Could you possible sort the required array, or at least produce an array that's consistently in the same order? That would really help me out.

IoT-master commented 7 years ago

"required": [ "high" "low_moderate" "low" "moderate" "moderate_high" ]

is compared to:

"required": [ "moderate_high" "high" "moderate" "low_moderate" "low" ]

as a fail (as an example)