Skip to content

Generic and container type mapping #19

@Shishir99-code

Description

@Shishir99-code

Problem

list[Model], dict[str, Model], tuples and sets don't map to the right spec array/object schemas.

Acceptance criteria

  • list[Model]/set[Model] → spec array with item schema; dict[str, Model] → object/additionalProperties
  • Tuple types map to a reasonable array schema; nested containers resolve recursively
  • Tests covering list-of-model, dict-of-model, and nested containers

Guardrails (must hold — the AI reviewer enforces these)

  • Python 3.11+, from __future__ import annotations in every module, strict mypy, ruff clean (line length 100)
  • Parser stays AST-only — never import or exec the analyzed project
  • No new runtime dependency without strong justification in the PR (CI dep-count matters)
  • .docguard.yaml config stays backwards-compatible
  • No LLM in the check/report path; output stays deterministic (sorted, no clocks/network)
  • Internal data = stdlib @dataclass with to_dict(); exit codes 0/1/2
  • Add pytest coverage including a false-positive / missed-endpoint case where relevant

Likely files

  • src/docguard/parsers/fastapi_parser.py
  • src/docguard/core/comparator.py
  • tests/test_type_fidelity.py

Out of scope

Numpy/pandas container types.


Part of epic: Epic: Deep type fidelity — eliminate the last false positives. Picked up autonomously by the DocGuard pipeline when moved to Ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions