Skip to content

Pre-existing fixture failures: example project.yaml and input_example.yml do not pass validate #68

Description

@JoshuaHarris391

Summary

While shipping v2.5.0, two pre-existing validation failures were confirmed in the repo's example artifacts. Neither is a regression — both reproduce on main before the v2.5.0 changes — but they mean the committed examples don't pass the tool's own validate command, and they forced a workaround in the new test suite.

1. tests/gen3_schema/examples/yaml/project.yamlconsent_codes array has no items

RuleValidator.type_array_needs_items rejects the fixture:

ValueError: Schema 'project' property 'consent_codes' with type 'array' must include an 'items' property.

The fixture (lines ~123-128) declares consent_codes as type: array with only a description. The shipped template src/gen3schemadev/schema/schema_templates/project.yaml has the correct shape for the same property (items with type: string, the DUO enum, and enumDef).

Fix: copy the items block from the template's consent_codes into the fixture (or regenerate the fixture from the current template).

2. tests/input_example.yml — project node missing a required code property

RuleValidator.project_must_require_code rejects any dictionary generated from the example input:

ValueError: Schema 'project' must include 'code' in the 'required' list.

The example input's user-defined project node only declares project_id and description, so the generated project.yaml never gets code in required. Gen3 uses code as the unique project identifier, so the example teaches users an input model that fails the tool's own validation:

poetry run gen3schemadev generate -i tests/input_example.yml -o output
poetry run gen3schemadev validate -y output   # fails on project_must_require_code

Fix: add a code property with required: true to the project node in tests/input_example.yml (and check tests/input_example_fail.yml / tests/input_example_file_props.yml for the same gap where a project node is defined). Update any converter test expectations that assert on the project node's properties (e.g. test_construct_prop_project in tests/test_converter.py).

Cleanup once fixed

(Obsolete: tests/test_fix_refs_pipeline.py was removed in v2.6.1 when the allOf wrapping feature was reverted.) No test currently exercises full validation of the example fixtures; once the fixtures are repaired, consider adding one so every non-excluded example schema must pass RuleValidator outright.

Acceptance criteria

  • poetry run gen3schemadev validate -y passes on a dictionary generated from tests/input_example.yml.
  • RuleValidator passes on every non-excluded schema in tests/gen3_schema/examples/yaml/.
  • poetry run pytest -vv tests/ stays green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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