Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

adding 'type=object' headers in swagger YAML not supported for Developer Portal - API documentation

I'm trying to define a request header as a JSON object but this is not being supported in the try-it-now function of the docportal, on swagger editor it works perfectly fine. Thank you!

 

/something/import-users:
    post:
      description: ''
      parameters:
      - in: header
        name: x-mc-arg
        required: false
        description : A JSON object containing an x-mc-arg Header Object.
        schema:
          properties:
            data:
              items:
                properties:
                  allowAddressMigration:
                    description: If using a AAA account structure, this option will allow the import to migrate the address from one account to another. 
                      If set to true, the user's accountCode value will be used as the target account. The default value is false.
                    type: boolean
                  clearGroup:
                    description: If being used to add users to a group with a groupId, this option can be used to determine if the group 
                      should be cleared prior to making additions. The default value is false.
                    type: boolean
                  fileType:
                    description: Specifies the file format of the data submitted in the request body. Must be one of CSV, XLS. The default value is XLS.
                    enum:
                    - XLS
                    - CSV
                    type: string
                  groupId:
                    description: The secure ID of a Profile Group, to which the users should be added.
                    type: string
                  notifyEmailAddress:
                    description: Email address of a recpient to be notified when the user import has completed.
                    type: string
                type: object
              maxItems: 1
              type: array
          type: object

 

 

Solved Solved
0 2 911
1 ACCEPTED SOLUTION

I dont know why this is not working as expected, although it does seem strange to me to include JSON as a header. This is better suited for Apigee Support. Pls open a ticket so we can take a deeper look and figure out if this is a bug, or working as intended.

In the meantime, you could try modifying the schema of the 'x-mc-arg' header to a `type: string`, then you can add an example or extend your description to be declarative of what the API is expecting.

View solution in original post

2 REPLIES 2

I dont know why this is not working as expected, although it does seem strange to me to include JSON as a header. This is better suited for Apigee Support. Pls open a ticket so we can take a deeper look and figure out if this is a bug, or working as intended.

In the meantime, you could try modifying the schema of the 'x-mc-arg' header to a `type: string`, then you can add an example or extend your description to be declarative of what the API is expecting.

It's one of those weird legacy endpoints :). Unfortunately making it a 'type: string' will mark it on the right hand side as a 'string', that could be misleading for the users of that endpoint, although it can work as temporary workaround. Thanks a lot for the suggestion!