understanding-json-schema icon indicating copy to clipboard operation
understanding-json-schema copied to clipboard

amend if/then/else example

Open karenetheridge opened this issue 3 years ago • 4 comments

...so the if clause is not true when "country" is missing

karenetheridge avatar Jan 13 '22 21:01 karenetheridge

✔️ Deploy Preview for lucid-bardeen-10edfb ready!

🔨 Explore the source changes: 31b1aa5d0dd1bc03681345fdce9b263e2a097584

🔍 Inspect the deploy log: https://app.netlify.com/sites/lucid-bardeen-10edfb/deploys/61e099c716a909000710b750

😎 Browse the preview: https://deploy-preview-185--lucid-bardeen-10edfb.netlify.app

netlify[bot] avatar Jan 13 '22 21:01 netlify[bot]

Build failed... https://app.netlify.com/sites/lucid-bardeen-10edfb/deploys/61e099c716a909000710b750#L114-L122

9:31:06 PM: Exception occurred:
9:31:06 PM:   File "/opt/build/repo/source/sphinxext/jsonschemaext.py", line 149, in run
9:31:06 PM:     raise ValueError(
9:31:06 PM: ValueError: Doc says fragment should pass, but it does not validate:
9:31:06 PM: {
9:31:06 PM:   "street_address": "1600 Pennsylvania Avenue NW",
9:31:06 PM:   "postal_code": "20500"
9:31:06 PM: }
9:31:06 PM: VALIDATION ERROR

Relequestual avatar Jan 14 '22 09:01 Relequestual

it would help if it said why validation failed...

karenetheridge avatar Jan 14 '22 22:01 karenetheridge

The schema is correct as it is. If the country is not set, USA is assumed and therefore the postal code (if present) needs to be a USA postal code.

It's a bit complicated for an intro example. Last time I went through it, I just fixed the errors and kept the same example, but it really could use a less confusing example.

jdesrosiers avatar Jan 17 '22 02:01 jdesrosiers