keymanapp / keymanapp/keyman

feat(developer): kmc-convert add line numbers to the err when using reportMessage() 😎

Open
#14,367 0 comments 0 reactions 2 assignees Claimed by @mcdurdin View on GitHub
developer/ epic-kmc-convert feat
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

At present kmc-convert writes out an Error message while finding an Error during validation.
This is done in the `validate() `function of `developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-file-reader.ts` :

```
public validate(source: KeylayoutXMLSourceFile): boolean {
if (!SchemaValidators.default.keylayout(source)) {
for (const err of (SchemaValidators.default.keylayout).errors) {
this.callbacks.reportMessage(DeveloperUtilsMessages.Error_SchemaValidationError({
instancePath: err.instancePath,
keyword: err.keyword,
message: err.message || 'Unknown AJV Error', // docs say 'message' is optional if 'messages:false' in options
params: Object.entries(err.params || {}).sort().map(([k, v]) => `${k}="${v}"`).join(' '),
}));
}
return false;
}
return true;
}
```

**For the future we need to write out line numbers as well. This can be done similar to the solution in kmc-ldml.**

see [comment ](https://github.com/keymanapp/keyman/pull/14013#discussion_r2211593294) in PR #14013

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.