Closed cumafo closed 5 years ago
Hmm. I'm using the same versions.
Have you tried with with your schemas and this instance with the command-line-tool?
looking closer at your code and changed initialization of validator in my class from ... , validator(schemaLoader) ... to ... , validator(schemaLoader, [](const std::string &, const std::string &) {}) ...
and then it worked. I don't understand why, loading of the sub-schemas worked in both cases. Shouldn't there be a compile/link error? /C
anway - for our usage, this lib seem to be about 3 times faster than valijson (1-2ms vs 5-6ms).
One question.....: what version of your software and nlohmann did you use verifying my json? Trying your "master" and nlohmann 3.5.0 I get "no validation has succeeded but ANYOF/ONEOF them is required to validate" on different objects depending on which of the json-files I check. /C
2019-02-04 13:55:48.549 *** ./tomgwc 3.0 starting ...... 2019-02-04 13:55:48.661 loading json schemas schemas-json//business-definitions.json schemas-json//customer-definitions.json schemas-json//item-definitions.json schemas-json//monetary-definitions.json schemas-json//sales-recording-system-definitions.json schemas-json//tender-definitions.json schemas-json//service-common-definitions.json schemas-json//taxi-definitions.json .... 2019-02-04 13:56:07.922 request: POST /re-gateway/receipt HTTP/1.1 2019-02-04 13:56:07.922 Request=/re-gateway/receipt 2019-02-04 13:56:07.923 login not required, using nouser 2019-02-04 13:56:07.923 New receipt from nouser () 2019-02-04 13:56:07.923 Validating json receipt: (unverified user nouser session nosession) hash 16dd9c8182b9f11d8d2078ed4d65e4fc7f1ba628 2019-02-04 13:56:07.924 Validation failed:ERROR: '' - '{"email":"your@email.com"}': no validation has succeeded but ANYOF/ONEOF them is required to validate. 2019-02-04 13:56:07.924 { "business_unit" : { "service_id": "5922f97b-feb1-48d6-b9a6-ef76f76ebdce", "organization_number": "556838-8200", "name": "Findity store AB", "contact" : { "address": { "street_address": "Engelbrektsgatan 20", "locality": "Ludvika", "postal_code": "77187" }, "phone": "tel:+46-0771-584886" } }, "cashier" : { "id" : "5", "name" : "Anna Andersson" }, "sales_recording_system" : { "serial_number" : "EA38329", "name" : "kassa 3" }, "receipt_number" : { "sequence_number": 123456, "receipt_code" : "1281111260543493" }, "time_of_purchase" : "2018-11-09T08:49:00+01:00", "currency" : "SEK", "totals" : [ {"amount_type" : "net" , "amount" : 280.00}, {"amount_type" : "vat" , "amount" : 70.00, "taxable_amount" : 280.00, "tax_percentage": "25"}, {"amount_type" : "vat" , "amount" : 70.00}, {"amount_type" : "gross" , "amount" : 395.00}, {"amount_type" : "discount" , "amount" : 45.00}, {"amount_type" : "rounding" , "amount" : 0.00}, {"amount_type" : "paid", "amount" : 350.00} ], "text" : [ {"position" : "header", "value" : "Öppettider:\n Måndag - Fredag 10-18\n Lördag 10-15"}, {"position" : "header", "value" : "Another header text..."}, {"position" : "footer", "value" : "Sommarerbjudande:\n Köp 3 par skor få det billigaste paret på köpet."} ], "items" : [{ "type" : "sale", "identifiers" : [ {"identifier_type" : "pos", "value" : "912042"}, {"identifier_type" : "gtin", "value" : "1234567890"} ], "description" : "Skor 42 - Foder BR", "quantity" : 1, "unit" : "ea", "unit_cost_price" : 395, "discount_amount": 45, "actual_sales_unit_price" : 350, "extended_amount" : 350, "tax_percentage" : 25 }], "payments": [ { "tender": { "type": "cash" }, "amount_applied_to_bill": 350.00, "amount": 350.00 } ], "customer": { "id": { "email": "your@email.com" } }, "control_unit": { "id": "RIHTT102710007088", "code": "BGXOV2QOHHILXHLPHHXRAYZEKGFNC2BD;" }}
Originally posted by @cumafo in https://github.com/pboettch/json-schema-validator/issues/50#issuecomment-460241836