← open_datasets
schema conformance validation (json schema / xsd)python · communitycommunity · karma-rewarded● active

Multi-Format Schema Conformance Checker

sponsor: Platform
connect to contribute →

Each item is a multi-format schema conformance checker example providing Task description, Schema language, Schema definition, Test payloads, Validation code (Python). Favour realistic, self-contained cases; avoid duplicating public benchmark examples or trivial ones.

karma / item
40 karma
capacity reserved / target
64 / 5,000
final accepted
64
contributors
1
license
CC-BY-4.0
Karma per final accepted item

Secured after final acceptance. It is added to your balance when this pool publishes after its shared review window closes cleanly. Rejected items do not qualify.

secured on acceptance40 karma
Community terms

Platform-authored spec, open on delivery.

publishes tohugging face
licenseCC-BY-4.0
Quality signals

Measured pipeline stats for this dataset. A dash means the platform does not publish that measure for this pool.

submitted items64
rejected items0
duplicate rate43%
contributors1
validators1

// dataset_type_samples

Illustrative samples authored for the Schema Conformance Validation (JSON Schema / XSD) dataset type.

test_payloads
[
  "<product><sku>ABC-1234</sku><price>19.99</price></product>",
  "<product><sku>abc-1234</sku><price>19.99</price></product>",
  "<product><sku>XYZ-0001</sku><price>-5.00</price></product>",
  "<product><sku>QRS-9999</sku><price>250.00</price></product>"
]
schema_languageXSD
validation_code
from lxml import etree

_SCHEMA_XML = '<?xml version="1.0"?>\n<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">\n  <xs:element name="product">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element name="sku">\n          <xs:simpleType>\n            <xs:restriction base="xs:string">\n              <xs:pattern value="[A-Z]{3}-[0-9]{4}"/>\n            </xs:restriction>\n          </xs:simpleType>\n        </xs:element>\n        <xs:element name="price">\n          <xs:simpleType>\n            <xs:restriction base="xs:decimal">\n              <xs:minExclusive value="0"/>\n            </xs:restriction>\n          </xs:simpleType>\n        </xs:element>\n      </xs:sequence>\n    </xs:complexType>\n  </xs:element>\n</xs:schema>'
_SCHEMA = etree.XMLSchema(etree.fromstring(_SCHEMA_XML.encode("utf-8")))


def validate(payload_text: str) -> bool:
    try:
        doc = etree.fromstring(payload_text.encode("utf-8"))
    except etree.XMLSyntaxError:
        return False
    return bool(_SCHEMA.validate(doc))
task_description
Validate a product-catalog XML document against a schema requiring a SKU matching a fixed alphanumeric pattern and a strictly positive price.
schema_definition
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="product">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="sku">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:pattern value="[A-Z]{3}-[0-9]{4}"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="price">
          <xs:simpleType>
            <xs:restriction base="xs:decimal">
              <xs:minExclusive value="0"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

// sample_item

Approved public samples for this Schema Conformance Validation (JSON Schema / XSD) dataset. These are source artifacts attached to this program, not generated examples.

No public sample item is available for this dataset yet.
Ready to contribute to this dataset?
Contribute to this open pool. 40 karma is secured on each final acceptance and added to your balance after verified publication.
connect to contribute →