nikku / nikku/node-xsd-schema-validator

Validation failing with "invalid xml" for incorrect file path

Open
#24 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog bug pr welcome
Dominant language
JavaScript
Stars
60
Forks
23
Avg merge
3d 21h
Merged PRs (30d)
1

Description

Describe the Bug

When providing the wrong path to a file, the error given is invalid xml (status=WITH_ERRORS). Nothing in the error points to the real problem: the path provided is not a file.

Steps to Reproduce

const validator = require('xsd-schema-validator');
const schemaFile = './path/to/schema.xsd';
const file = './foo.xml'; // Wrong path - file does not exist
validator.validateXML({ file }, schemaFile, function(err, result) {
   if (err) throw err;
});

Expected Behavior

Error should give some indication that the file you're trying to test is not actually where you think it was.

Environment

  • Node v14.16.0
  • OS: Windows
  • Version 0.7.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the validateXML entry point shown in the reproduction and trace how the provided file path is handled. Add coverage for the nonexistent-path case and verify that the resulting error identifies the missing file rather than reporting only invalid XML.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.