Skip to content

Three YAML files fail to parse with PyYAML / standard YAML loaders #13

Description

@bturner-oti

While loading the OAP ontology programmatically with Python's yaml.safe_load, three files in data/ fail to parse. All issues are pure YAML lint, not semantic:

  1. data/facilities/site.yaml (line 58)

Stray TAB character at end of line:

  - primaryFunction: Courthouse<TAB>

Fix: Strip the trailing tab.

  1. data/type-tags.yaml (lines 1430–1463)

34 consecutive lines in the primaryFunction ENUM list have trailing TAB characters (looks like a paste from a tab-delimited source):

- Bank Branch<TAB>
- Casino<TAB>
- College/University<TAB><TAB>
- Courthouse<TAB>
...

Fix: Strip trailing whitespace across the block. A one-liner: sed -i 's/[[:space:]]*$//' data/type-tags.yaml.

  1. data/waste/equip.waste.yaml (lines 1–7)

Two issues at the top of the file:

Waste equipment definitions

Bin

  • Extend base type

BIN
name: Waste Bin
Lines 3–4 (Bin / - Extend base type) appear to be a draft note that isn't valid YAML.
Line 6 (BIN) is missing its trailing :, so the loader can't recognize it as a mapping key — which is why the parser then errors at the name: on line 7 with mapping values are not allowed here.
Fix:

Waste equipment definitions

BIN:
name: Waste Bin
...
(Comment out or remove the "Bin / - Extend base type" lines, and add : after BIN.)

Reproduction:

import yaml
for f in ['data/facilities/site.yaml', 'data/type-tags.yaml', 'data/waste/equip.waste.yaml']:
try:
yaml.safe_load(open(f).read())
except yaml.YAMLError as e:
print(f, e)
Impact for downstream consumers: any tool using a strict YAML parser silently loses ~263 type-tag entries, the BIN equipment definition, and the COURT site definition unless it implements per-file fallback / lint repair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions