Missing required property: items"

2,446 views
Skip to first unread message

Shan Gopalakrishnan

unread,
Jun 10, 2016, 2:05:34 PM6/10/16
to Swagger
Team, need help. i am getting an error for the below spec in swagger. can you please let me know why .. as when i just create a schema definition, not sure why it complains for "items".   couldnt see any documentation which explains the hierarchy of the swagger nodes. below is the error i get and also further below the actual Yaml content that I created.



i get the above in a few lines though. please help when you get a chance.


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
  title: Product Information
  description: Information related to Products and Options
  version: "1.0.0"
# the domain of the service
# array of all schemes that your API supports
schemes:
  - https
# will be prefixed to all paths
basePath: /v1
produces:
  - application/json
paths:
  /products/5:
    get:
      summary: Product Details
      description: |
        The Products endpoint returns information about the  products
        and all its options, features and footnotes.  If invoked without a product id, it will return an array of all products.
      tags:
        - Products
      responses:
        200:
          description: An array of products
          schema:
            type: array
            items:
              $ref: '#/definitions/Product'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
            

 
definitions:
  Product:
    type: object
    properties:
      categoryIds:
        type: array
      chargeList:
        $ref: '#/definitions/ChargeList'
      defaultOptionProducts:
        type: array
      isEmbedType:
        type: boolean
      isExcluded: 
        type: boolean
      isInstalled: 
        type: boolean
      isReplacement: 
        type: boolean
      productSO:
        $ref: '#/definitions/ProductSO'
      ProductInformation:
        $ref: '#/definitions/ProductInformation'
      ProductFootNote:
        $ref: '#/definitions/ProductFootNote'
      AssociatedFeatures:
        $ref: '#/definitions/AssociatedFeatures'
  
  ChargeList:
    type: object
    properties:
      ChargeType__c:
        type: string
      Apttus_Config2__ListPrice__c: 
        type: integer
      Apttus_Config2__ChargeType__c: 
        type: string
  
  ProductSO:
    type: object
    properties:
      Id: 
        type: string
      Name: 
        type: string
      Uom__c: 
        type: string
      ProductCode:
        type: string
      Customizable__c:
        type: boolean
      IsActive:
        type: boolean
      Description:
        type: string
      ConfigurationType__c:
        type: string
      HasOptions__c:
        type: boolean
      HasAttributes__c:
        type: boolean
      rating: 
        type: integer
      Apttus_Config2__Uom__c:
        type: string
      Apttus_Config2__Customizable__c:
        type: boolean
      Apttus_Config2__ConfigurationType__c:
        type: string
      Apttus_Config2__HasOptions__c:
        type: boolean
      Apttus_Config2__HasAttributes__c:
        type: boolean
      AttributeGroupIds:
        type: array
      OptionGroupIds:
        type: array


  ProductInformation:
    type: object
    properties:
      Id: 
        type: string
      OwnerId: 
        type: string
      IsDeleted: 
        type: boolean
      Name: 
        type: string
      CreatedDate: 
        type: string
      CreatedById: 
        type: string
      LastModifiedDate: 
        type: string
      LastModifiedById: 
        type: string
      SystemModstamp: 
        type: string
      ContentUrl__c: 
        type: string
      Description__c: 
        type: string
      InformationType__c: 
        type: string
      ProductId__c: 
        type: string
          
          
  ProductFootNote:
    type: object
    properties:
      Id: 
        type: string
      OwnerId: 
        type: string
      IsDeleted: 
        type : boolean
      Name: 
        type: string
      CreatedDate: 
        type: string
      CreatedById: 
        type: string
      LastModifiedDate: 
        type: string
      LastModifiedById:
        type: string
      SystemModstamp:
        type: string
      Type__c: 
        type: string

  AssociatedFeatures:
    type: object
    properties:
      ProductFeatureValueSOs:
          $ref: '#/definitions/ProductFeatureValueSOs'
      FeatureSetSO:
          $ref: '#/definitions/FeatureSetSO'


  ProductFeatureValueSOs:
    type: object
    properties:
      Id:
        type: string
      FeatureId__c: 
        type: string
          
  FeatureSetSO:
    type: object
    properties:
      Id: 
        type: string
      Name: 
        type: string
        
  Error:
    type: object
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
      fields:
        type: string

tony tam

unread,
Jun 10, 2016, 2:08:53 PM6/10/16
to swagger-sw...@googlegroups.com
The editor is telling you exactly what is wrong.  You have an array, and do not specify what is in it with the “items”, and the issue is on line 44.


    properties:
      categoryIds:
        type: array

Give categoryIds (and any other arrays without “items”) and life will be good.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shan Gopalakrishnan

unread,
Jun 20, 2016, 7:10:41 PM6/20/16
to Swagger
thank you
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Tony Tam

unread,
Jun 20, 2016, 7:30:21 PM6/20/16
to swagger-sw...@googlegroups.com
defaultOptionProducts and possibly other properties, is missing the array type information, which lives in the "items" property. 
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages