question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

General information

  • json-editor version: 2.0-dev
  • I fixed a few other tests before (minor errors), but the validations for certain objects are not working correctly.
  • Fixing this is a high priority to me, since validations are very important

https://travis-ci.org/json-editor/json-editor/jobs/571279410

Expected behavior

validation_test.js should pass.

Actual behavior

It doesn’t.

Steps to reproduce the behavior

Run tests from develop/2.x-fix-tests.

 codeceptjs run editors/validation_test.js 

The output with the failures:

required4 [test valid 0]: success
required4 [test invalid 0]: fail. Expected: errors, Actual: []
required4 [test invalid 1]: success
required4 [test invalid 2]: success
required4_merge [test valid 0]: success
required4_merge [test invalid 0]: fail. Expected: errors, Actual: []
required4_merge [test invalid 1]: fail. Expected: errors, Actual: []

The corresponding test data:

required4: {
            schema: {
                type: "object",
                properties: {
                    required: {}
                },
                required: ["required"],
                additionalProperties: true
            },
            valid: [
                {required: true, test: 1}
            ],
            invalid: [
                {},
                "a string",
                [1,2,3]
            ]
        },
        required4_merge: {
            schema: {
                type: "object",
                properties: {
                    orig: {},
                    other: {}
                },
                required: ["orig"],
                oneOf: [
                    {
                        required: ["other"]
                    }
                ]
            },
            valid: [
                {
                    orig: true,
                    other: true
                }
            ],
            invalid: [
                {
                    orig: true
                },
                {
                    other: true
                }
            ]
        },

So an empty object {} is now accepted, but it should trigger an error.

And oneOf seems not to be correctly evaluated, since only an object with orig AND other should be valid.

CC: @pmk65 @wclssdn Can you shed some light and/or fix this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
pmk65commented, Aug 13, 2019

@schmunk42 I found the culprit. It was the code I added for Button and Info editors in src/validator.js. I have pushed a fix to the develop/2.x branch.

0reactions
schmunk42commented, Aug 14, 2019

Yes, we can do that, but on the other hand we’re running this test always in the CI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google reenables the validate fix feature in Search Console ...
Validate fix is back. Now when you go into Google Search Console and click on some of the coverage reports, the “validate fix”...
Read more >
Message Validation : OnixS .NET FIX Engine
FIX Engine has the ability to validate any incoming messages and to reject that does not fit for the FIX protocol or its...
Read more >
Fix Validation Errors - Pressbooks User Guide
Export validation error banner on the Exports screen. Each type of file is validated against different standards, so their validation logs will also...
Read more >
How can I fix validation errors? - Customer Support - Gengo
Validating Jobs Before you can submit your translations, jobs are validated. This happens automatically, and there are two types of...
Read more >
Correcting Data Validation Errors - IBM
This validation ensures all data adheres to the input schema requirements and is valid and usable. You must correct any errors the data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found