diff --git a/docs/docs.go b/docs/docs.go index ca74a4b..f904c18 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -27,7 +27,7 @@ const docTemplate = `{ "get": { "description": "Generate barcodes based on the provided data", "produces": [ - "application/pdf" + "image/png" ], "tags": [ "barcodes" @@ -59,6 +59,11 @@ const docTemplate = `{ }, "/v1/pdfs/cards": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate cards based on the provided data", "consumes": [ "application/json" @@ -86,6 +91,11 @@ const docTemplate = `{ }, "/v1/pdfs/certificates": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate certificates based on the provided data", "consumes": [ "application/json" @@ -113,6 +123,11 @@ const docTemplate = `{ }, "/v1/pdfs/contracts": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate a contract based on the provided data", "consumes": [ "application/json" @@ -369,12 +384,7 @@ const docTemplate = `{ "name": "key", "in": "query" } - }, - "security": [ - { - "ApiKeyAuth": [] - } - ] + } }` // SwaggerInfo holds exported Swagger Info so clients can modify it diff --git a/docs/swagger.json b/docs/swagger.json index 155833b..8bfb4c3 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -18,7 +18,7 @@ "get": { "description": "Generate barcodes based on the provided data", "produces": [ - "application/pdf" + "image/png" ], "tags": [ "barcodes" @@ -50,6 +50,11 @@ }, "/v1/pdfs/cards": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate cards based on the provided data", "consumes": [ "application/json" @@ -77,6 +82,11 @@ }, "/v1/pdfs/certificates": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate certificates based on the provided data", "consumes": [ "application/json" @@ -104,6 +114,11 @@ }, "/v1/pdfs/contracts": { "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], "description": "Generate a contract based on the provided data", "consumes": [ "application/json" @@ -360,10 +375,5 @@ "name": "key", "in": "query" } - }, - "security": [ - { - "ApiKeyAuth": [] - } - ] + } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 14cc474..722db76 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -182,7 +182,7 @@ paths: required: true type: string produces: - - application/pdf + - image/png responses: {} summary: Generate barcodes tags: @@ -202,6 +202,8 @@ paths: produces: - application/pdf responses: {} + security: + - ApiKeyAuth: [] summary: Generate runner cards tags: - pdfs @@ -220,6 +222,8 @@ paths: produces: - application/pdf responses: {} + security: + - ApiKeyAuth: [] summary: Generate runner certificates tags: - pdfs @@ -238,11 +242,11 @@ paths: produces: - application/pdf responses: {} + security: + - ApiKeyAuth: [] summary: Generate a contract tags: - pdfs -security: -- ApiKeyAuth: [] securityDefinitions: ApiKeyAuth: in: query diff --git a/handlers/card.go b/handlers/card.go index c76c78b..51a1b65 100644 --- a/handlers/card.go +++ b/handlers/card.go @@ -16,6 +16,7 @@ import ( // @Accept json // @Param data body models.CardRequest true "Card data" // @Produce application/pdf +// @Security ApiKeyAuth // @Router /v1/pdfs/cards [post] func (h *DefaultHandler) GenerateCard(c *fiber.Ctx) error { cardRequest := new(models.CardRequest) diff --git a/handlers/certificate.go b/handlers/certificate.go index e41ad30..5255dc8 100644 --- a/handlers/certificate.go +++ b/handlers/certificate.go @@ -16,6 +16,7 @@ import ( // @Accept json // @Param data body models.CertificateRequest true "Certificate data" // @Produce application/pdf +// @Security ApiKeyAuth // @Router /v1/pdfs/certificates [post] func (h *DefaultHandler) GenerateCertificate(c *fiber.Ctx) error { certificateRequest := new(models.CertificateRequest) diff --git a/handlers/contract.go b/handlers/contract.go index 2c0ac7b..ed97eff 100644 --- a/handlers/contract.go +++ b/handlers/contract.go @@ -16,6 +16,7 @@ import ( // @Accept json // @Param data body models.ContractRequest true "Contract data" // @Produce application/pdf +// @Security ApiKeyAuth // @Router /v1/pdfs/contracts [post] func (h *DefaultHandler) GenerateContract(c *fiber.Ctx) error { contract := new(models.ContractRequest) diff --git a/main.go b/main.go index a0b2fd7..92ae678 100644 --- a/main.go +++ b/main.go @@ -86,7 +86,6 @@ func main() { v1 := app.Group("/v1") - // @Security ApiKeyAuth pdfv1 := v1.Group("/pdfs") pdfv1.Use(keyauth.New(keyauth.Config{ KeyLookup: "query:key",