Forum Discussion

harshulgoel's avatar
harshulgoel
Occasional Visitor
3 years ago

"items" as a property

Hi, I have a simple design where there are is a list of 'Item' in a 'Cart', now I want to keep 'items' as a property of this 'Cart' which is a list and contains 'Item' but this isn't working. I tried a similar situation with 'Items' as a property in 'Cart' instead and that worked fine and I am thinking 'items' isn't working because it's a swagger keyword, so is there any way I can use 'items' here? 

 

"components": {
    "schemas": {
      "Item": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Cart": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          }
        }
      },