cancel
Showing results for 
Search instead for 
Did you mean: 

"items" as a property

harshulgoel
Occasional Visitor

"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"
            }
          }
        }
      },

 

1 REPLY 1
HKosova
Moderator

Re: "items" as a property

Your schemas are correct. What exactly is not working and in which tool?


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video: