Last active
June 23, 2021 00:14
-
-
Save dviedma/daf1e5ea682ba8d0e5c8a68526294ea6 to your computer and use it in GitHub Desktop.
Category API schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "NI Category Page API", | |
"description": "A sample response from the Experience API that will feed NI's Category Page", | |
"type": "object", | |
"definitions": { | |
"filter": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"name": { | |
"type": "string", | |
"description": "Name of the filter to be diplayed in the UI i.e. Voltage Range" | |
}, | |
"description": { | |
"type": "string", | |
"description": "Description of the filter to be diplayed in the UI as a tooltip" | |
}, | |
"typeId": { | |
"type": "string", | |
"description": "NIs data Atribute Type i.e. unstructuredText, structuredMulti, etc" | |
}, | |
"order": { | |
"type": "integer", | |
"description": "The higher the order, the closer to the top the filter should appear" | |
}, | |
"isPinned": { | |
"type": "boolean", | |
"description": "Pinned filters always show at the top of the navigation and expanded by default" | |
}, | |
"isDisabled": { | |
"type": "boolean", | |
"description": "If all the options contained in a filter are disabled (because they lead to no-results), then this property should be true" | |
}, | |
"options": { | |
"type": "array", | |
"description": "The different values a given filter category can have for the user to select", | |
"items": { | |
"$ref": "#/definitions/filterOption" | |
}, | |
"default": [] | |
}, | |
"optionGroups": { | |
"type": "array", | |
"description": "The different values, grouped per units of measurement, a given filter category can have for the user to select", | |
"items": { | |
"$ref": "#/definitions/filterOptionGroup" | |
}, | |
"default": [] | |
} | |
}, | |
"required": [ | |
"id", | |
"name", | |
"typeId" | |
], | |
"anyOf": [ | |
{ | |
"required": [ | |
"options" | |
] | |
}, | |
{ | |
"required": [ | |
"optionGroups" | |
] | |
} | |
] | |
}, | |
"filterOption": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"value": { | |
"type": "string", | |
"description": "Value of the option to be diplayed in the UI. i.e. 'PXI Express'" | |
}, | |
"icon": { | |
"type": "string", | |
"description": "Path or reference to an icon (for Icon Lists only)" | |
}, | |
"isSelected": { | |
"type": "boolean", | |
"description": "Wheter this specific option is been selected by the user and currently active" | |
}, | |
"isDisabled": { | |
"type": "boolean", | |
"description": "If a given option leads to no results it should be disabled (greyed out to the user but still visible)" | |
} | |
}, | |
"required": [ | |
"id", | |
"value" | |
] | |
}, | |
"filterOptionGroup": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"name": { | |
"type": "string", | |
"description": "Value to the displayed on the tab i.e. KV/s" | |
}, | |
"values": { | |
"type": "array", | |
"description": "The different values for that specific unit of measurement", | |
"items": { | |
"$ref": "#/definitions/filterOption" | |
}, | |
"default": [] | |
} | |
} | |
}, | |
"productData": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"name": { | |
"type": "string", | |
"description": "Name of the property i.e. Bus Type" | |
}, | |
"value": { | |
"type": "string", | |
"description": "Value of the property i.e. C Series" | |
} | |
}, | |
"required": [ | |
"id", | |
"name", | |
"value" | |
] | |
}, | |
"product": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"name": { | |
"type": "string", | |
"description": "Name of the product or model" | |
}, | |
"description": { | |
"type": "string", | |
"description": "Description of the product or model" | |
}, | |
"url": { | |
"type": "string", | |
"description": "URL of the product or model" | |
}, | |
"price": { | |
"type": "string", | |
"description": "Price of the product or model" | |
}, | |
"image": { | |
"type": "string" | |
}, | |
"productData": { | |
"type": "array", | |
"description": "The different key/value pairs containing the product info", | |
"items": { | |
"$ref": "#/definitions/productData" | |
}, | |
"default": [] | |
} | |
}, | |
"required": [ | |
"id", | |
"name", | |
"url", | |
"price", | |
"productData" | |
] | |
} | |
}, | |
"properties": { | |
"filters": { | |
"description": "List of filters to populate the sidebar faceted nav", | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/filter" | |
}, | |
"default": [] | |
}, | |
"products": { | |
"description": "List of products to display in the product grid", | |
"type": "object", | |
"properties": { | |
"totalRecords": { | |
"type": "integer" | |
}, | |
"productsList": { | |
"type":"array", | |
"items":{ | |
"$ref":"#/definitions/product" | |
} | |
} | |
}, | |
"items": { | |
"$ref": "#/definitions/product" | |
}, | |
"default": [] | |
}, | |
"pagination": { | |
"description": "Handles the information regarding pagination for the product grid", | |
"type": "object", | |
"properties": { | |
"totalProducts": { | |
"type": "integer" | |
}, | |
"totalPages": { | |
"type": "integer" | |
}, | |
"currentPage": { | |
"type": "integer" | |
}, | |
"prevPage": { | |
"type": "integer" | |
}, | |
"nextPage": { | |
"type": "integer" | |
} | |
}, | |
"required": [ | |
"totalProducts", | |
"totalPages", | |
"currentPage" | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment