Skip to content

Instantly share code, notes, and snippets.

@kkajero
Last active November 16, 2021 01:58
Show Gist options
  • Save kkajero/024ca07c3df8c906f1df31e33b7e7553 to your computer and use it in GitHub Desktop.
Save kkajero/024ca07c3df8c906f1df31e33b7e7553 to your computer and use it in GitHub Desktop.
MMV3 Schema With Nutrition Information
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Restaurant",
"type": "object",
"additionalProperties": false,
"properties": {
"RestaurantId": {
"type": "string"
},
"Name": {
"type": "string",
"description": "Restaurant's name"
},
"Description": {
"type": [ "string", "null" ]
},
"Availabilities": {
"type": "array",
"items": {
"$ref": "#/definitions/Availability"
}
},
"Categories": {
"type": "array",
"items": {
"$ref": "#/definitions/Category"
}
},
"Items": {
"type": "array",
"items": {
"$ref": "#/definitions/MenuItem"
}
}
},
"definitions": {
"Availability": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"Description": {
"type": [ "string", "null" ]
},
"ServiceTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [ "collection", "delivery", "dineIn" ]
}
},
"Times": {
"type": "array",
"items": {
"$ref": "#/definitions/Time"
}
}
}
},
"Time": {
"type": "object",
"additionalProperties": false,
"properties": {
"DayOfTheWeek": {
"type": "array",
"items": {
"type": "string",
"enum": [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]
}
},
"FromDateTime": {
"type": "string",
"description": "Time of Day the Availability begins, format is hh:mm:ss"
},
"ToDateTime": {
"type": "string",
"description": "Time of Day the Availability ends, format is hh:mm:ss"
}
}
},
"Category": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"Description": {
"type": [ "string", "null" ]
},
"Buy1Get1Free": {
"type": "boolean"
},
"Buy1Get1HalfPrice": {
"type": "boolean"
},
"ItemIds": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"MenuItem": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"Type": {
"type": "string",
"enum": [ "menuitem", "deal" ],
"description": "Indicates if it's a regular menu item or a deal."
},
"RequireOtherProducts": {
"type": "boolean",
"description": "Cannot be selected as a stand alone item, it has to be ordered with other items. Typically this will include Drinks and Dessert Categories."
},
"Description": {
"type": [ "string", "null" ]
},
"ImageUrl": {
"type": [ "string", "null" ]
},
"Labels": {
"type": "array",
"items": {
"type": "string"
}
},
"Images": {
"type": [ "array", "null" ],
"items": {
"$ref": "#/definitions/Image"
}
},
"Variations": {
"type": "array",
"items": {
"$ref": "#/definitions/Variation"
}
},
"ModifierGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/ModifierGroup"
}
},
"DealGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/DealGroup"
}
}
}
},
"Image": {
"type": "object",
"additionalProperties": false,
"properties": {
"Source": {
"type": "string",
"description": "Can be either `Cloudinary` or `Cloudinaryv2`. The client is expected to construct the url differently based on this type."
},
"Id": {
"type": [ "string", "null" ],
"description": "Used for `Cloudinary` type images to store the identifier of the file in the Cloudinary CDN."
},
"UrlTemplate": {
"type": [ "string", "null" ],
"description": "Used for `Cloudinaryv2` type images to store the whole url of the file, with a placeholder to be filled called `{transformations}`"
}
}
},
"Variation": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string",
"description": "Name of the variation. NOTE: Variations of type 'NoVariation' will be an empty string"
},
"Type": {
"type": "string",
"enum": [ "Variation", "NoVariation" ],
"description": "Indicates if a Variation is of default type (NoVariation) or one of many the user can choose from (Variation)."
},
"BasePrice": {
"type": "number",
"format": "decimal"
},
"KitchenNumber": {
"type": [ "string", "null" ],
"description": "Identifies the item with a number in the physical menu, like in chinese menus for example 16 will correspond to 'BBQ ribs'."
},
"DealOnly": {
"type": "boolean",
"description": "This flag indicates the Variation is only available as part of a deal, the item will not be displayed as a stand alone menu item."
},
"AvailabilityIds": {
"type": "array",
"description": "Maps to an Availability item, Availabilities determines which days and times the item can be sold.",
"items": {
"type": "string"
}
},
"ModifierGroupsIds": {
"type": "array",
"items": {
"type": "string"
}
},
"DealGroupsIds": {
"type": "array",
"items": {
"type": "string"
}
},
"Nutrition": {
"type": "object",
"$ref": "#/definitions/NutritionInformation"
},
"NumberOfServings": {
"type": "object",
"$ref": "#/definitions/NumberOfServingsInformation"
}
}
},
"ModifierGroup": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"MinChoices": {
"type": "integer",
"format": "int32"
},
"MaxChoices": {
"type": "integer",
"format": "int32"
},
"Modifiers": {
"type": "array",
"items": {
"$ref": "#/definitions/Modifier"
}
},
"NumberOfServings": {
"type": "object",
"$ref": "#/definitions/NumberOfServingsInformation"
}
}
},
"Modifier": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"MinChoices": {
"type": "integer",
"format": "int32"
},
"MaxChoices": {
"type": "integer",
"format": "int32"
},
"DefaultChoices": {
"type": "integer",
"format": "int32"
},
"AdditionPrice": {
"type": "number",
"format": "decimal"
},
"RemovePrice": {
"type": "number",
"format": "decimal",
"description": "This value should be removed from the base price of the Item, and represented as a positive number. For example, if there's a Burger item with a base price of £5.50 and a few side options like Fries and Salad, where Salad has a RemovePrice of 1. If Salad is selected, £1 should be removed from the base price, so the burger will cost £4.50."
},
"Nutrition": {
"type": "object",
"$ref": "#/definitions/NutritionInformation"
},
"NumberOfServings": {
"type": "object",
"$ref": "#/definitions/NumberOfServingsInformation"
}
}
},
"DealGroup": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"NumberOfChoices": {
"type": "integer",
"format": "int32"
},
"DealItemVariations": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/DealItemVariation"
}
}
}
},
"DealItemVariation": {
"type": "object",
"additionalProperties": false,
"properties": {
"DealItemVariationId": {
"type": "string",
"description": "This corresponds to a Menu Item Variation Id, these are the Item Variations that make up a Deal Group. NOTE: This is not limited to DealOnly Variations, this ID can reference Item Variations with the DealOnly flag set to TRUE or FALSE."
},
"MinChoices": {
"type": "integer",
"format": "int32"
},
"MaxChoices": {
"type": "integer",
"format": "int32"
},
"AdditionPrice": {
"type": "number",
"format": "decimal"
}
}
},
"NutritionInformation":{
"type":"object",
"properties": {
"EnergyContent":{
"type":"array",
"items": {
"type":"object",
"uniqueItems": true,
"$ref": "#/definitions/NutritionalRangeItem"
}
}
}
},
"NutritionalRangeItem":{
"type":"object",
"description": "A nutritional item that can be expressed as a range or as a single value if min and max coincide.",
"required": [
"Min",
"Max",
"Unit"
],
"properties": {
"Min":{
"type": "integer",
"format": "int32",
"description": "The min value."
},
"Max":{
"type": "integer",
"format": "int32",
"description": "The max value."
},
"Unit":{
"oneOf":[
{"$ref": "#/definitions/Energy"}
],
"type":"string",
"description": "The unit of measure."
}
}
},
"Energy":{
"enum": [
"kcal",
"kJ"
]
},
"NumberOfServingsInformation":{
"type":"object",
"description": "The number of servings can be expressed as a range or as a single value if min and max coincide.",
"required": [
"Min",
"Max"
],
"properties": {
"Min":{
"type": "integer",
"format": "int32",
"description": "The min number of servings."
},
"Max":{
"type": "integer",
"format": "int32",
"description": "The max number of servings."
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment