Skip to content

BE001: Ensure Product Detail API response matches frontend contract and passes schema validation#26

Open
Aarya1801 wants to merge 1 commit intomainfrom
BE001---Validate-Product-Detail-API-Response-Structure
Open

BE001: Ensure Product Detail API response matches frontend contract and passes schema validation#26
Aarya1801 wants to merge 1 commit intomainfrom
BE001---Validate-Product-Detail-API-Response-Structure

Conversation

@Aarya1801
Copy link
Copy Markdown
Collaborator

@Aarya1801 Aarya1801 commented Mar 30, 2026

Ticket

Description

-Reviewed and updated the map_enriched_to_product_detail.py mapping function to ensure the Product Detail API response strictly matches the agreed JSON contract (api/contracts/product_v1.json) used by the frontend.
-Enforced presence, type, and default values for all required and optional fields in the API response, including arrays, objects, and nullable fields, to guarantee consistent structure for UI rendering.
-Patched the mapping logic to handle missing or null values robustly, ensuring no required field is omitted and all types are correct.
-Renamed the folder database/clean data to database/clean_data and updated all relevant import paths and file references for Python module compatibility.
-Fixed import statements in the mapping and related scripts to use the new clean_data path.
-Ran the schema validation script (scripts/schema_validate_harness.py) on 50 sample products to automatically verify contract compliance.
-Validation result: 0 errors, confirming the API response is fully compliant with the frontend contract.

Checks

  • All requirements of the ticket have been implemented, or I have commented on any exclusions
  • Unit tests have been added or updated for any backend changes (if applicable)
  • I have reviewed the Files Changed tab and verified it only contains relevant changes (comment if unsure about any)
  • This PR has been reviewed and approved

Screenshots

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant