UBL 2.3 JSON Alternative Representation Version 1.0: OASIS Committee Note
UBL 2.3 JSON Alternative Representation Version 1.0: OASIS Committee Note
Previous stage:
https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cnd02/UBL-2.3-JSON-v1.0-cnd02.html
https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cnd02/UBL-2.3-JSON-v1.0-cnd02.pdf
https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cnd02/UBL-2.3-JSON-v1.0-cnd02.xml (Au
thoritative)
Latest stage:
https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/UBL-2.3-JSON-v1.0.html
https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/UBL-2.3-JSON-v1.0.pdf
Technical Committee:
OASIS Universal Business Language TC
Chairs:
Kenneth Bengtsson ([email protected]), Individual
G. Ken Holman ([email protected]), Crane Softwrights Ltd.
Editors:
Kenneth Bengtsson ([email protected]), Individual
Erlend Klakegg Bergheim ([email protected]), Norwegian Digitalisation Agency
G. Ken Holman ([email protected]), Crane Softwrights Ltd.
Additional artefacts:
This prose specification is one component of a Work Product that also includes:
• https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/json-legacy/
• https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/json-model/
• https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/json-schema-model/
• https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/val/
• https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/UBL-2.3-JSON-v1.0-cn01.zip
Related work:
This note is related to:
Universal Business Language Version 2.3. Edited by G. Ken Holman. 15 June 2021. OASIS Stand
ard. https://docs.oasis-open.org/ubl/UBL-2.3.html.
[BDNDR] Business Document Naming and Design Rules (BDNDR) Version 1.1. Edited by Ken
neth Bengtsson, Erlend Klakegg Bergheim and G. Ken Holman. 08 November 2021. Com
mittee Specification 01. https://docs.oasis-open.org/ubl/Business-Document-NDR/v1.1/cs01/
Business-Document-NDR-v1.1-cs01.html. Latest stage: https://docs.oasis-open.org/ubl/Busi
ness-Document-NDR/v1.1/Business-Document-NDR-v1.1.html.
Abstract:
This committee note supplements the OASIS Universal Business Language version 2.3 release
with an alternative expression of the UBL sample XML documents in JSON syntax, and two
JSON schema expressions of all 91 XSD schemas in conformance to the OASIS Business
Document Naming and Design Rules Version 1.1.
Status:
This document was last revised or approved by the OASIS Universal Business Language TC
on the above date. The level of approval is also listed above. Check the “Latest stage” location
noted above for possible later revisions of this document. Any other numbered Versions and
other technical work produced by the Technical Committee (TC) are listed at https://www.oasis-
open.org/committees/tc_home.php?wg_abbrev=ubl#technical.
TC members should send comments on this specification to the TC’s email list. Others should
send comments to the TC’s public comment list, after subscribing to it by following the instruc
tions at the “Send A Comment” button on the TC’s web page at https://www.oasis-open.org/
committees/ubl/.
See Appendix A, Release Notes for more information regarding this release package.
Citation format:
When referencing this note the following citation format should be used:
[UBL-2.3-JSON] UBL 2.3 JSON Alternative Representation Version 1.0. Edited by Kenneth Bengts
son, Erlend Klakegg Bergheim and G. Ken Holman. 01 December 2021. OASIS Commit
tee Note 01. https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/cn01/UBL-2.3-JSON-v1.0-
cn01.html. Latest stage: https://docs.oasis-open.org/ubl/UBL-2.3-JSON/v1.0/UBL-2.3-JSON-
v1.0.html.
All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellec
tual Property Rights Policy (the “OASIS IPR Policy”). The full Policy may be found at the OASIS
website.
This document and translations of it may be copied and furnished to others, and derivative works
that comment on or otherwise explain it or assist in its implementation may be prepared, copied,
published, and distributed, in whole or in part, without restriction of any kind, provided that the above
copyright notice and this section are included on all such copies and derivative works. However,
this document itself may not be modified in any way, including by removing the copyright notice or
references to OASIS, except as needed for the purpose of developing any document or deliverable
produced by an OASIS Technical Committee (in which case the rules applicable to copyrights, as set
forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages other
than English.
The limited permissions granted above are perpetual and will not be revoked by OASIS or its succes
sors or assigns.
This document and the information contained herein is provided on an “AS IS” basis and OASIS
DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWN
ERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE.
Appendixes
For users of JSON syntax, this note publishes two suites of JSON schemas with which one can
validate the structural content of a JSON document against the constraints of the UBL 2.3 vocabulary.
Also included are two transliterations of all of the UBL 2.3 example documents in JSON syntax with
which one can test a number of the JSON schemas.
The structural patterns exhibited by JSON schemas that conform to the OASIS Business Document
Naming and Design Rules Version 1.1 [BDNDR] are distinctive as document interchange structures.
As such, their intent is only to convey in syntax the information content reflecting the same abstract
model of the UN/CEFACT Core Component Technical Specification 2.01 [CCTS] with which the docu
ment model was designed. The rules govern two possible JSON schema structures, a legacy-based
approach supporting future backwards compatibility, and a model-based approach specific to this
version of UBL. Accordingly, and in parallel to an application’s use of XML syntax, the legacy-based
JSON syntax used is generic in nature, supported by schemas of all versions of UBL. The model-
based JSON syntax is suitable only for schemas conforming to the UBL 2.3 structures. Neither syntax
is streamlined nor optimized for any particular application’s objectives
As one would undertake the unmarshalling of XML syntax into internal application data structures
suitable for processing, one must also undertake the unmarshalling of JSON interchange syntax into
whatever internal application data structures (or other JSON representations) of the content that are
suitable for the task at hand. Of note, it has been observed that there are commercial JSON database
tools unable to ingest this JSON interchange syntax directly without an application massaging the
content first to suit the database schema necessary to enable a particular arbitrary use. Nevertheless,
the JSON syntax used does conform to the published standard [ISO 21778 - ECMA JSON] and has
been successfully demonstrated to be ingested by Python and Node.js applications and so is not a
barrier to use for application developers.
The UBL Technical Committee makes no assumptions regarding how the XML syntax of UBL docu
ments is to be managed by applications, and so similarly makes no assumptions regarding how any
application’s use of the JSON syntax is to be managed. With the only objective being the lossless
interchange of document content, the structures in both XML and legacy-based JSON syntax are
designed with forward and backward compatibility in mind for applications that ingest the content.
Certain constraints in future versions of UBL may be lessened in a backward compatible fashion,
such as in regard to cardinality, and so applications can successfully ingest the arrays of objects used
in this regard to accommodate changing cardinality. Moreover, transliteration can be accomplished
without semantic interpretation of any contents that would require specialized treatment of any given
construct.
In contrast, model-based JSON syntax is not designed with forward and backward compatibility due
to different conventions for expressing structures of different maximum cardinality. Where a CCTS
construct is specified to have an unbounded maximum cardinality, an array is used in the same
way arrays are used in legacy-based JSON syntax. Where a CCTS construct is specified to have a
bounded maximum cardinality of “1”, the structure is serialized without using an array. Accordingly, the
serialization of JSON or the transliteration from XML requires knowledge of the maximum cardinality
of all constructs in order to use the appropriate structures. When a version of UBL changes a
construct’s maximum cardinality (which can be from bounded to unbounded only), a past instance no
longer will validate with the new schemas. This breaks forward compatibility from the past instance’s
perspective, and backward compatibility from a new instance’s perspective.
The UBL document schemas make provision for constraining UBL extension metadata but not for
constraining extension content. The user wishing to validate extension content is expected to replace
the common/UBL-ExtensionContentDataType-2.3.json fragment with one’s own specification
of extension constraints. No other schema fragment is expected to be touched by users.
1.2 Terminology
1.2.1 Terms and Definitions
Document
A set of information components that are exchanged as part of a business transaction; for
example, in placing an order.
JSON schema
A JSON document [ISO 21778 - ECMA JSON] definition conforming to the JSON schema lan
guage [JSON Schema].
XSD schema
An XML document [XML] definition conforming to the W3C XML Schema language [XSD1]
[XSD2].
XML
XSD
1.3 References
[BDNDR] Business Document Naming and Design Rules (BDNDR) Version 1.1. Edited by Ken
neth Bengtsson, Erlend Klakegg Bergheim and G. Ken Holman. 08 November 2021.
Committee Specification 01. https://docs.oasis-open.org/ubl/Business-Document-NDR/v1.1/
cs01/Business-Document-NDR-v1.1-cs01.html. Latest stage: https://docs.oasis-open.org/ubl/
Business-Document-NDR/v1.1/Business-Document-NDR-v1.1.html.
[CCTS] UN/CEFACT Core Component Technical Specification - Part 8 of the ebXML Framework)
15 November 2003 Version 2.01 http://www.unece.org/fileadmin/DAM/cefact/codesfortrade/
CCTS/CCTS_V2-01_Final.pdf
[JSON Schema] JSON Schema Validation: A Vocabulary for Structural Validation of JSON, A. Wright,
G. Luff, Editors, http://json-schema.org/latest/json-schema-validation.html
[XML] Extensible Markup Language (XML) 1.0 (Second Edition), W3C Recommendation 6 October
2000
[XSD1] XML Schema Part 1: Structures. Second Edition. W3C Recommendation 28 October 2004
[XSD2] XML Schema Part 2: Datatypes. Second Edition. W3C Recommendation 28 October 2004
When modeling, CCTS governs how to define a class of business documents by specifying the avail
able components as information bundles to be deployed to users as user data. An ABIE (aggregate)
From an abstract information bundle perspective, a given business document is comprised of its
Document ABIE with its indivisible BBIEs and with its (divisible) ASBIEs that each have their own
BBIEs and ASBIEs.
Each BBIE is defined by its data type. The available Core Component Types are summarized in
Chapter 8 of the CCTS 2.01 specification [CCTS]. Each type has a mandatory content component
and a number of optional metadata supplementary components. The interpretation of the content
is informed by the values of its given supplementary components. The data type content and supple
mentary component values are, ostensibly, either numbers, strings or Boolean values. Interpreting the
strings to be abstract concepts such as date and time is up to the program.
Names in XML documents are qualified with namespace URI strings. These UBL JSON schemas
provide for preserving the four uses of XML namespaces in a source XML document that might have
been transliterated to JSON syntax. This allows the JSON document to be “round-tripped” back to
XML syntax should it be necessary. Accommodating extension content is up to extension designers.
The following four properties are for documentary or transliteration purposes, and for completeness
should be present:
• name “_D” with the string value of the Document ABIE namespace URI;
• name “_A” with the string value of the ASBIE namespace URI (that is, the Library ABIE namespace
URI);
• name “_B” with the string value of the BBIE namespace URI; and
• name “_E” with the string value of the extension namespace URI (when extensions are being used).
That apex object always contains a property with the name of the Document ABIE. In legacy-based
schemas the value is an array containing a single Document ABIE object. In model-based schemas
the value is the Document ABIE object, not in an array.
The Document ABIE object contains properties, in any order, of all of the ASBIE and BBIE members
in actual use of those available as specified by the Document ABIE. In legacy-based schemas, each
property is defined as an array. In model-based schemas, only those properties associated with the
model’s definition of the maximum cardinality as unbounded are defined as an array. Properties with
bounded maximum cardinality are defined as an object.
A UBL example of a serialized legacy-based Document ABIE with some content elided by the ellipsis
for brevity, leaving three BBIEs followed by an ASBIE that itself has two BBIEs is as follows:
{"_D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"_A":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
"_B":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
"Invoice":[{
"ID":[{"_":"123"}],
"IssueDate":[{"_":"2011-09-22"}],
"Note":[{"_":"Information text for the invoice"}],
"InvoicePeriod":[{
"StartDate":[{"_":"2011-08-01"}],
"EndDate":[{"_":"2011-08-31"}]
}],
...
}]}
A UBL example of a serialized model-based Document ABIE with the same content elided by the
ellipsis for brevity, leaving three BBIEs followed by an ASBIE that itself has two BBIEs is as follows,
given that the identifier and issue date both have a bounded maximum cardinality of “1” and the note
and invoice period structures each have an unbounded maximum cardinality:
{"_D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"_A":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
"_B":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
"Invoice":{
"ID":{"_":"123"},
"IssueDate":{"_":"2011-09-22"},
"Note":[{"_":"Information text for the invoice"}],
"InvoicePeriod":[{
"StartDate":{"_":"2011-08-01"},
"EndDate":{"_":"2011-08-31"}
}],
...
}}
The one name for that property is the name of the ASBIE. In legacy-based serialization the one
value for that property is an array of one or more objects, each object representing, in array order,
the sequence order of the consecutive ASBIEs. In model-based serialization, the property is simply
the object itself if the maximum cardinality is bounded to “1”, otherwise an array is used as in
legacy-based serialization regardless of he number of ASBIEs. If there are no ASBIEs of a given
name, the property is absent.
Each object in the ASBIE array contains as its properties all of the ASBIE and BBIE members in
actual use of those available as specified by the Library ABIE that defines the ASBIE.
"Party":{
"PartyName":[{
"Name":[{"_":"Custom Cotter Pins"}]
}]
}
This legacy-based serialization for two “InvoiceLine” ASBIEs has as children two BBIEs and an
ASBIE, where that ASBIE has on BBIE child:
"InvoiceLine":[{
"ID":[{"_":"1"}],
"LineExtensionAmount":[{"_":100.00,
"currencyID":"CAD"}],
"Item":[{
"Description":[{"_":"Cotter pin, MIL-SPEC"}]
}]
},{
"ID":[{"_":"2"}],
"LineExtensionAmount":[{"_":200.00,
"currencyID":"CAD"}],
"Item":[{
"Description":[{"_":"Axel"}]
}]
}]
This model-based serialization for the same two “InvoiceLine” ASBIEs has as children two BBIEs
and an ASBIE, where that ASBIE has on BBIE child:
"InvoiceLine":[{
"ID":{"_":"1"},
"LineExtensionAmount":{"_":100.00,
"currencyID":"CAD"},
"Item":{
"Description":[{"_":"Cotter pin, MIL-SPEC"}]
}
},{
"ID":{"_":"2"},
"LineExtensionAmount":{"_":200.00,
"currencyID":"CAD"},
"Item":{
"Description":[{"_":"Axel"}]
}
}]
Each BBIE has a required property whose name is the underscore symbol and whose value is the
value of the business object in the information bundle.
Each BBIE may have as many additional properties with the names and values of optional or required
metadata supplementary components of the given instance of the Core Component Type. Such is
defined by the BDNDR unqualified data types. Provision is made in the model for qualifying the data
types, and such are enumerated in UBL’s qualified data types. UBL provides no qualifications in the
JSON model and so it is up to the application to impose qualifications as needed.
The property names are derived from the XML Schema attributes for the approved CCTS 2.01 core
component type content and supplementary component names. The list of available property attribute
names is summarized as follows, with required properties indicated:
Table 1. CCTS 2.01 approved core component type content and supplementary components for
permissible representation terms
Some legacy-based serialization examples of BBIEs: an identifier, a date and two notes:
• "ID":[{"_":"123"}]
• "IssueDate":[{"_":"2011-09-22"}]
• "Note":[{"_":"Test",
"LanguageIdentifier":"en"},
{"_":"Tester",
"LanguageIdentifier":"fr"}]
That one member of the array is an object named “UBLExtension”, declared to be an array of
one or more members, each member being a single extension (of which there may be many). Each
member is an object that may have any number of properties of extension metadata, whose names
are defined by the vocabulary. Each object has a property with the name “ExtensionContent”) as
an array of one object. That one object defines the foreign extension content.
The definition of foreign content is out of scope of this document. Trading partners must agree on the
significance or insignificance of any foreign content.
The examples in this section are copied from the interactive interfaces of the Node.js interpreter and
the Python interpreter.
The JSON stream creates an object with the optional properties of the namespaces and the manda
tory property of Document ABIE. The name of that property is the name of the Document ABIE.
The value of that property is the array of one object defining the contents of the Document ABIE
comprised of BBIEs and ASBIEs.
The Document ABIE and each BBIE and ASBIE must be addressed as a list that is guaranteed to
have at the least a single member addressed with “[0]”.
Note
Future versions of UBL may raise the cardinality of any given object and so this approach
is future-proof to revisions. This approach is also consistent and is used without thought of
cardinality and so should be easier for the programmer (if a little verbose). Although a change
in cardinality does not apply to the Document ABIE, the array notation is used for consistency
with ASBIE expressions using arrays.
The content of a BBIE is addressed as the object property with the name “_”. Supplementary compo
nents of a BBIE are addressed by their equivalent XML Schema attribute name. For a complete list,
see Table 1, “CCTS 2.01 approved core component type content and supplementary components for
permissible representation terms”.
> obj.Invoice[0].Note[0]
{ _: 'Test', languageID: 'en' }
> obj.Invoice[0].Note[1]
{ _: 'Tester', languageID: 'fr' }
> obj.Invoice[0].Note[1]._
'Tester'
> obj.Invoice[0].InvoiceLine[1].LineExtensionAmount[0]._
200
> obj.Invoice[0].InvoiceLine[1].LineExtensionAmount[0].currencyID
'CAD'
>
This approach also supports the object notation defined in JavaScript. The same examples using list
and object notation syntax for a legacy-based instance:
> obj["Invoice"][0]["Note"][0]
{ _: 'Test', languageID: 'en' }
> obj["Invoice"][0]["Note"][1]
{ _: 'Tester', languageID: 'fr' }
> obj["Invoice"][0]["Note"][1]["_"]
The JSON stream creates a dictionary with a single array of one property. The name of that property
is the name of the Document ABIE. The value of that property is the object defining the contents of
the Document ABIE comprised of BBIEs and ASBIEs.
Each BBIE and ASBIE must be addressed as a list that is guaranteed to have at the least a single
member addressed with “[0]”.
Note
Future versions of UBL may raise the cardinality of any given object and so this approach
is future-proof to revisions. This approach is also consistent and is used without thought of
cardinality and so should be easier for the programmer (if a little verbose). Although a change
in cardinality does not apply to the Document ABIE, the array notation is used for consistency
with ASBIE expressions using arrays.
The content of a BBIE is addressed as the dictionary property with the name ending in “Content”.
Supplementary components of a BBIE are addressed by their name (compressed removing periods
and spaces). For a complete list, see Table 1, “CCTS 2.01 approved core component type content
and supplementary components for permissible representation terms”.
Some examples using list and dictionary syntax for a legacy-based instance:
>>> obj["Invoice"][0]["Note"][0]
{'_': 'Test', 'languageID': 'en'}
>>> obj["Invoice"][0]["Note"][1]
{'_': 'Tester', 'languageID': 'fr'}
>>> obj["Invoice"][0]["Note"][1]["_"]
'Tester'
>>> obj["Invoice"][0]["InvoiceLine"][1]["LineExtensionAmount"][0]["_"]
200.0
>>> obj["Invoice"][0]["InvoiceLine"][1]["LineExtensionAmount"][0]["currencyID"]
'CAD'
>>>
Note
Observe how the Python list and dictionary syntax is identical to the JavaScript list and object
syntax.
For legibility the examples are indented. Indentation is insignificant white space and optionally can be
eliminated from the file.
The remaining sections are examples of legacy-mode JSON instances. See the model-mode directory
for examples of the use of model-mode serialization.
3.2 UBL-Invoice-2.1-Example-Trivial.json
{"_D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"_A":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
"_B":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
"Invoice":[{
"ID":[{"_":"123"}],
"IssueDate":[{"_":"2011-09-22"}],
"InvoicePeriod":[{
"StartDate":[{"_":"2011-08-01"}],
"EndDate":[{"_":"2011-08-31"}]
}],
"AccountingSupplierParty":[{
"Party":[{
"PartyName":[{
"Name":[{"_":"Custom Cotter Pins"}]
}]
}]
}],
"AccountingCustomerParty":[{
"Party":[{
"PartyName":[{
"Name":[{"_":"North American Veeblefetzer"}]
}]
}]
}],
"LegalMonetaryTotal":[{
"PayableAmount":[{"_":100.00,
"currencyID":"CAD"}]
}],
"InvoiceLine":[{
"ID":[{"_":"1"}],
"LineExtensionAmount":[{"_":100.00,
"currencyID":"CAD"}],
"Item":[{
"Description":[{"_":"Cotter pin, MIL-SPEC"}]
}]
}]
}]}
{"_D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"_A":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
"_B":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
"Invoice":[{
"ID":[{"_":"123"}],
"IssueDate":[{"_":"2011-09-22"}],
"Note":[{"_":"Test",
"languageID":"en"},
{"_":"Tester",
"languageID":"fr"}],
"InvoicePeriod":[{
"StartDate":[{"_":"2011-08-01"}],
"EndDate":[{"_":"2011-08-31"}]
}],
"AccountingSupplierParty":[{
"Party":[{
"PartyName":[{
"Name":[{"_":"Custom Cotter Pins"}]
}]
}]
}],
"AccountingCustomerParty":[{
"Party":[{
"PartyName":[{
"Name":[{"_":"North American Veeblefetzer"}]
}]
}]
}],
"LegalMonetaryTotal":[{
"PayableAmount":[{"_":100.00,
"currencyID":"CAD"}]
}],
"InvoiceLine":[{
"ID":[{"_":"1"}],
"LineExtensionAmount":[{"_":100.00,
"currencyID":"CAD"}],
"Item":[{
"Description":[{"_":"Cotter pin, MIL-SPEC"}]
}]
},{
"ID":[{"_":"2"}],
"LineExtensionAmount":[{"_":200.00,
"currencyID":"CAD"}],
"Item":[{
"Description":[{"_":"Axel"}]
}]
}]
}]}
3.4 UBL-Order-2.1-Example.json
{"_D":"urn:oasis:names:specification:ubl:schema:xsd:Order-2",
"_A":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
jsonvalidate.py
Note
At the time of writing, it is observed that the jsonschema library is not functioning
correctly under Windows. The Windows invocations are included in this Committee Note
distribution in anticipation of a future release of the library working successfully.
Invoking the validate scripts once for each of the four sample files in the val/ subdirecto
ry: order-test-bad1.json (bad syntax), order-test-bad2.json (bad property name),
order-test-bad3.json (missing required property), order-test-bad4.json (invalid date
value), and order-test-good.json (no errors).
Note
At the time of writing, it is observed that the jsonschema library is not correctly detecting
an invalid date value in the order-test-bad4.json test file. This is due to the specifi
cation making support of such optional for implementations to offer.
Invoking the validate scripts once for each of the sample files in the json-legacy/ subdirectory.
Invoking the Python application once with the arguments of a JSON schema and a JSON docu
ment.
To demonstrate the successful validation of all of the sample JSON documents with the correspond
ing JSON schema, one would invoke the tests in a Unix-based environment as follows:
~/t $ cd mytest
~/t/mytest $ ls
json json-schema val
~/t/mytest $ cd val
~/t/mytest/val $ ls
jsonvalidate.py order-test-good.json testjsonsamples.sh
order-test-bad1.json output.txt validatejson.bat
order-test-bad2.json testjson.bat validatejson.sh
order-test-bad3.json testjson.sh
order-test-bad4.json testjsonsamples.bat
~/t/mytest/val $ sh testjson.sh
############################################################
Validating order-test-bad1.json with ../json-schema-legacy/maindoc/UBL-Order-2.3.json
############################################################
############################################################
Validating order-test-bad2.json with ../json-schema-legacy/maindoc/UBL-Order-2.3.json
############################################################
Validation error: Additional properties are not allowed (u'OrderDocumentReferenceXXXXX'
validator: additionalProperties
path: deque([u'Order', 0])
cause: None
context: []
validator_value: False
schema_path: deque([u'properties', u'Order', u'items', u'additionalProperties'])
parent: None
############################################################
Validating order-test-bad3.json with ../json-schema-legacy/maindoc/UBL-Order-2.3.json
############################################################
Validation error: u'ID' is a required property
validator: required
path: deque([u'Order', 0])
cause: None
context: []
validator_value: [u'ID', u'IssueDate', u'BuyerCustomerParty', u'SellerSupplierParty', u'
schema_path: deque([u'properties', u'Order', u'items', u'required'])
parent: None
############################################################
Validating order-test-bad4.json with ../json-schema-legacy/maindoc/UBL-Order-2.3.json
############################################################
No schema validation errors.
############################################################
Validating order-test-good.json with ../json-schema-legacy/maindoc/UBL-Order-2.3.json
############################################################
No schema validation errors.
~/t/mytest/val $
art
db
json-legacy
json-model
json-schema-legacy
json-schema-model
val
A.4 Support
UBL is a volunteer project of the international business community. Inquiries regarding UBL may be
posted to the public ubl-dev list, archives for which are located at
https://lists.oasis-open.org/archives/ubl-dev/
OASIS provides an official community gathering place and information resource for UBL at
http://ubl.xml.org/
http://www.wikipedia.org/wiki/Universal_Business_Language