Skip to content

Confusing error message “unknown node type”, caused by the YAML schema #70

@johannessen

Description

@johannessen

YAML config on 1.3.1-diagnostics (f1c1935):

- individual_directory:
    - Alfa: 555666777

Expected

The entry is accepted, because it has a legal name and a MMSI with the correct length.

Actual

The entry is rejected, with the error message “unknown node type”.

Discussion

The error message is technically inaccurate, the node type is known to be scalar. But the average user is probably unfamiliar with such specific YAML terminology, which means this error message is potentially confusing.

Apparently the YAML parser applies the YAML Core Schema, which results in 555666777 being treated as a number. However, that value does match the correct format for a MMSI. There is no ambiguity at all. Therefore, it should just work.

Another symptom of the same problem is evident in entry names:

- individual_directory:
    - Null: "555666777"

“Null” is a completely legal (albeit perhaps uncommon) name for a boat. More to the point, in this particular context, it’s absolutely clear that Null is the boat’s name and is meant to be resolved to tag:yaml.org,2002:str rather than tag:yaml.org,2002:null. However, what actually happens is the same error message “unknown node type” being shown.

Apart from Null, there are some other scalars that aren’t resolved as strings in the Core Schema and therefore cause this issue when used as a name, e. g. True, 42, .Inf.

Proposal

It would appear that the Core Schema is not perfectly suited for our purposes. I think we should consider defining a custom YAML schema.

If that doesn’t pan out, at minimum we should try to restrict the parser to the Failsafe Schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions