Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger 2.0 Accept-Language header as request parameter

I'm writing a specification for a http API using Swagger 2.0.

How can I define the Accept-Language header as a required header parameter for a path?

/aPath:
post:
  parameters:
    - in: header
      name: Accept-Language
      type: string
      enum: [de, en, es]
      required: true
  responses:
    200:
      description: The Best
      schema:
        type: string

Documentation on header parameters says

Swagger specification has special keywords for some headers: enter image description here

How can I use the keyword produces to define an Accept-Language header?

like image 761
Michael_H Avatar asked Oct 28 '25 02:10

Michael_H


1 Answers

Your definition is correct.

The page you mentioned talks about the Accept header, which is different from Accept-Language.

like image 64
Helen Avatar answered Oct 30 '25 23:10

Helen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!