Repository navigation
Fix/endpoints response fields - #1
Conversation
Real Bling payloads often send only "link" in midia.imagens.internas[],
while the vendored OpenAPI spec marks 6 fields as required, making
produtos.obter() raise BlingAPIError (ValidationError) on most products.
Relax link_miniatura, validade, ordem, anexo and anexo_vinculo via
generator overrides (Bug 6, following the Bug 4/5 pattern in
scripts/generate_models.py); link intentionally stays required.
Add real-world-shaped fixture for GET /produtos/{idProduto} and model
parse tests covering link-only, complete and imagensURL entries, plus a
regression test pinning link as required.
make codegen at HEAD emitted ~100 files of drift unrelated to any change: 12 re-export stubs (nfce, usuarios, logisticas_*) that were never committed, +909 lines of Nfce/Logisticas operation metadata missing from _operation_models.py, contracts formatting that relied on pre-commit's ruff format instead of the generator, and docs EOF whitespace fixed only by pre-commit hooks. Root causes fixed in the generators: - generate_openapi_contracts.py now runs ruff format over contracts and writes docs with final-newline/no-trailing-whitespace (mirroring generate_models.py, which already self-normalized) - generate_models.py template now preserves the manual TODO docstring in models/generated/resources/__init__.py verbatim After this, make codegen-check is meaningful as a drift gate (CI gate added separately).
make codegen-check now fails on untracked files in generated directories, both before and after regeneration (generate_models.py wipes and rewrites models/generated, so a post-only check would miss strays the wipe removed). Adds a codegen-drift job to GitHub Actions and a local pre-commit hook that only triggers when generation-relevant files change (spec, generators, generated artifacts, generated docs).
…ions Raw datamodel-codegen output spells aliases as alias="<BlingName>", but the clone gate only looked for validation_alias/serialization_alias — keywords that exist only after _rewrite_field_aliases, which never runs on inserted redeclarations. Every parent-alive insert therefore fell back to a bare None, and the first future override on an inherited camelCase field would silently emit a redeclaration without aliases, making to_json_object() serialize the wrong wire key. Extend the gate to the raw alias form and normalize the clone into the repo-standard validation_alias=AliasChoices(...) + serialization_alias pair. Alias-less parents keep the bare None fallback, so the 12 live override keys' output stays byte-identical (verified with a clean generator run and git diff --exit-code).
Mira PR WalkthroughThis PR aligns the generated model schemas and operation contracts so API endpoints return correctly-typed response fields — primarily fixing product ( 24 files reviewed
|
No description provided.