How to add common headers using spring fox 3

35 Views Asked by At

I use spring fox 3 to generate the swagger document.

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

Currently there are 20 APIs in this swagger document, 18 of them have some common headers as below:

                    {
                        "name": "uuid",
                        "in": "header",
                        "description": "128 bit random universally unique identifier (UUID)",
                        "type": "string",
                        "required": true
                    },
                    {
                        "name": "channelId",
                        "in": "header",
                        "description": "Registered channel ID",
                        "type": "string",
                        "required": true
                    },
                    {
                        "name": "businessCode",
                        "in": "header",
                        "description": "Business code",
                        "type": "string",
                        "required": true
                    },

But 2 of them don't need the headers.

Appreciate a lot if you can advise a solution using spring fox 3 to realize that the 18 APIs have the common headers but the 2 APIs don't have.

0

There are 0 best solutions below