Add example showing how to handle null attributes

This commit is contained in:
Max Martens 2025-02-26 09:41:47 +01:00
parent 9b00a42d5d
commit c21f8f9e34

View File

@ -43,13 +43,41 @@ paths:
schema: schema:
$ref: '#/components/schemas/ProductPayloadListResponse' $ref: '#/components/schemas/ProductPayloadListResponse'
examples: examples:
getListNoProducts: No products / Empty list:
summary: No products / Empty list summary: No products / Empty list
description: No products description: No products
value: value:
{ {
"Entries": [] "Entries": []
} }
List containing one product with many null attributes:
summary: List containing one product with many null attributes
description: |-
Most product attributes are optional on a database level and can thus be null; this example shows that all attributes as defined in the schema are always represented in the response, even if null. \
**Empty lists/arrays show up as null, not as "[]"!**
value:
{
"Entries": [
{
"productId": 99,
"productCode": null,
"productName": null,
"productDescription": null,
"productCategory": null,
"tokenTypes": null,
"sellableTouchPointIds": null,
"amountInclTax": null,
"imageReference": null,
"productPageUrl": null,
"_links": {
"get_details": {
"href": "https://services.acc.api.htm.nl/abt/abtserviceengine/2.0/products/99",
"method": "GET"
}
}
}
]
}
List containing one product with 4 currently active SellingPeriods (called by touchpointId 1): List containing one product with 4 currently active SellingPeriods (called by touchpointId 1):
summary: List containing one product with 4 currently active SellingPeriods (called by touchpointId 1) summary: List containing one product with 4 currently active SellingPeriods (called by touchpointId 1)
description: Only two sellingPeriods for touchpoint 1 and/or 2 (part of same retailer) are returned - the price for touchpointId 1 is returned description: Only two sellingPeriods for touchpoint 1 and/or 2 (part of same retailer) are returned - the price for touchpointId 1 is returned