Skip to content

Support Daffodil infoset validation equivalent to the CLI -V/--validate option #1762

Description

@hdalsania

Problem Description

Apache Daffodil’s parse command supports the -V / --validate option for validating the infoset generated during parsing:
-V, --validate <validator_name>
The VS Code extension should provide equivalent configuration for parse and debug operations.

This is different from #1273 , which validates the DFDL schema during schema compilation. This issue concerns validation of the resulting infoset after data has been parsed.

The current Apache Daffodil CLI supports the following validators:

off — disable infoset validation
daffodil — use Daffodil’s built-in XML Schema validation
xerces[=value] — use Xerces XML Schema validation
schematron[=value] — use Schematron validation
Custom validators registered with Daffodil

The optional value identifies a validator configuration file, such as an .xsd, .sch, .conf, or .properties file.

For example:

daffodil parse -s schema.dfdl.xsd -V daffodil input.dat
daffodil parse -s schema.dfdl.xsd -V xerces input.dat
daffodil parse -s schema.dfdl.xsd -V schematron=rules.sch input.dat

Proposed Solution

Add an infoset validation option to the extension’s launch configuration and Launch Wizard.

Possible launch configuration (consider to keep it with infoset config options):

{
  "validation": {
    "validator": "xerces",
    "configuration": "${workspaceFolder}/schema.dfdl.xsd"
  }
}

The configuration property should be optional and used only when required by the selected validator (Xerces or schematron).

The extension does not necessarily need to invoke the Daffodil CLI directly. It may implement the equivalent functionality through the DAPodil interfaces.

Acceptance Criteria

  • Launch configurations support an infoset validation setting.
  • The Launch Wizard allows users to select off, daffodil, xerces, or schematron.
  • Validation defaults to off.
  • Allow an optional configuration file for validators that support one.
  • The selected validator is applied during parsing.
  • Validation diagnostics are displayed in VS Code.
  • Validation diagnostics are distinguishable from schema compilation and parse errors.
  • Existing launch configurations remain backward compatible.
  • Continue producing or displaying the infoset when Daffodil makes it available following a validation failure.
  • Documentation explains the difference between this feature and schema validation in Ability to validate the .dfdl.xsd schema file before starting debug operation #1273.

Impact and Benefits

This feature allows users to validate the generated infoset directly in VS Code, identifying data that parses successfully but violates XSD or Schematron constraints. It improves Daffodil CLI parity and provides earlier feedback without leaving the IDE.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerIssues related to the DFDL debugger capabilityenhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions