Skip to content

Improve schema validationย #49

Closed
Closed

Description

@jonherrmann

ETF Improvement Proposal (EIP)

Background and Motivation:

The current BaseX test driver uses the BaseX validation module. This approach has limitations, for example, an older version of Xerces is used.

This approach also implies that validation is only executed as part of a regular assertion. In general, assertions are written assuming that the XML documents under test are valid. Invalid documents will often have side effects on unrelated assertions and can confuse the user. In general, only XML documents that are valid against a schema should be tested by an Executable Test Suite.

Proposed change

  • Add the capability to validate XML documents against a schema before loading the document in the BaseX database. XML documents that are invalid are not loaded into the database and are ignored in the tests.
  • If a test object consists of multiple XML documents, parsing will use parallel threads to improve the performance.
  • The latest version of Xerces-J will be used.
  • Validation errors reported by the parser are reported as a sequence of text nodes in the XQuery variable $validationErrors that can be used in assertions.
  • The schema documents to use for validation are configured as parameters of an Executable Test Suite or Test Run Template (see Test Run Templatesย #28). The parameters have the reserved name "schema" and the type "file-resource". Example:
<parameter name="schema" required="true" static="true">
  <defaultValue>DE/Ressourcen/schemas/adv/nas/6.0/aaa.xsd</defaultValue>
  <type>file-resource</type>
</parameter>
  • The schema documents can be stored locally with the test definitions to improve performance.

Alternatives

n/a

Funding

Yes

Additional information

Update https://github.com/etf-validator/etf-webapp/issues/181 in the process.

Activity

  1. added
    EIP-draftAnnouncement. Will not be discussed further as long as the necessary information is available.
    on Oct 2, 2018
  2. self-assigned this
    on Oct 2, 2018
  3. changed the title [-]Schema validation cache[/-] [+]Schema validation cache [DRAFT][/+] on Jan 14, 2019
  4. added
    EIPImprovement Proposal. Put up for discussion.
    and removed
    EIP-draftAnnouncement. Will not be discussed further as long as the necessary information is available.
    on Apr 24, 2020
  5. changed the title [-]Schema validation cache [DRAFT][/-] [+]Improve schema validation[/+] on Apr 24, 2020
  6. added
    EIP-approvedEIP approved by the Steering Group
    and removed
    EIPImprovement Proposal. Put up for discussion.
    on May 7, 2020
  7. added
    Impl.EIP has been implemented and is ready for the next release. Doc might be incomplete (temp. label)
    on May 23, 2022
  8. jonherrmann commented on Aug 19, 2022

    @jonherrmann
    ContributorAuthor

    Implemented in Version 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

EIP-approvedEIP approved by the Steering GroupImpl.EIP has been implemented and is ready for the next release. Doc might be incomplete (temp. label)

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions