Header Parameters are missing

veeraprasad
Participant II

Hi,

I am using parameters to have params in my API. Please check the below swagger. I have two parameters in it. But it does not display any params under Header Parameters. I have just one which is Content-Type. Is it correct behaviour or wrong swagger format?

swagger: '2.0'
info:
  version: 1.0.0
  title: MyAPI
  description: My API
host: myapi.apigee.net
basePath: /myapi
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  /details:
    post:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/param1'
        - $ref: '#/parameters/param2'
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/success'
definitions:
  success:
    type: string
    description: Success message
parameters:
  param1:
    name: key
    in: header
    description: key.
    required: true
    type: string
  param2:
    name: id
    in: header
    description: key2.
    required: true
    type: string

Regards,

Veera

0 5 1,292
5 REPLIES 5

Hi @Veera Prasad,

I don't see any problem with your swagger spec. It loads up nicely on the swagger editor

refer below

5328-capture.jpg

Hi @snehal chakraborty

Yeah you are correct Snehal...it loads perfectly in Swagger Editor. But when I import it in Drupal as SmartDoc, it does not work. I see parameters in full model object when I debug using {{this}}. But it does not include under Header Parameters. Am I missing something?

Regards,

Veera

Smartdocs has certain limitations. May be you can try this

swagger: '2.0'
info:
  version: 1.0.0
  title: MyAPI
  description: My API
host: myapi.apigee.net
basePath: /myapi
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  /details:
    post:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - name: key
          in: header
          description: key.
          required: true
          type: string
        - name: id
          in: header
          description: key2.
          required: true
          type: string
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/success'
definitions:
  success:
    type: string
    description: Success message

  

veeraprasad
Participant II

I think no active community to give anwer for my question 😞

veeraprasad
Participant II

Any help from @apigeek can be appreciated.