-
Notifications
You must be signed in to change notification settings - Fork 0
Swagger docs #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger docs #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds Swagger/OpenAPI documentation to the Database API Wrapper service. The changes include Swagger annotations in the main application file and handler functions, the addition of the go-swag tool to the development environment, and the generated Swagger documentation files.
Changes:
- Added Swagger metadata annotations (title, version, description, contact, license, host, basePath, security) to main.go
- Added Swagger endpoint documentation for GetID and Get (search) handlers
- Added go-swag tool to flake.nix for documentation generation
- Generated Swagger documentation in JSON, YAML, and Go formats
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| main.go | Added Swagger API metadata annotations |
| internal/handlers/product/getId.go | Added Swagger annotations for GET /products/{id} endpoint |
| internal/handlers/product/get.go | Added Swagger annotations for GET /products/search endpoint |
| flake.nix | Added go-swag package for generating Swagger documentation |
| docs/swagger.yaml | Auto-generated Swagger documentation in YAML format |
| docs/swagger.json | Auto-generated Swagger documentation in JSON format |
| docs/docs.go | Auto-generated Go package for Swagger documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Package docs Code generated by swaggo/swag. DO NOT EDIT | ||
| package docs | ||
|
|
||
| import "github.com/swaggo/swag" | ||
|
|
||
| const docTemplate = `{ | ||
| "schemes": {{ marshal .Schemes }}, | ||
| "swagger": "2.0", | ||
| "info": { | ||
| "description": "{{escape .Description}}", | ||
| "title": "{{.Title}}", | ||
| "termsOfService": "http://swagger.io/terms/", | ||
| "contact": { | ||
| "name": "API Support", | ||
| "url": "http://www.swagger.io/support", | ||
| "email": "support@swagger.io" | ||
| }, | ||
| "license": { | ||
| "name": "Apache 2.0", | ||
| "url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
| }, | ||
| "version": "{{.Version}}" | ||
| }, | ||
| "host": "{{.Host}}", | ||
| "basePath": "{{.BasePath}}", | ||
| "paths": { | ||
| "/products/search": { | ||
| "get": { | ||
| "security": [ | ||
| { | ||
| "Bearer": [] | ||
| } | ||
| ], | ||
| "description": "Search for products by name", | ||
| "consumes": [ | ||
| "application/json" | ||
| ], | ||
| "produces": [ | ||
| "application/json" | ||
| ], | ||
| "tags": [ | ||
| "products" | ||
| ], | ||
| "summary": "Search products", | ||
| "parameters": [ | ||
| { | ||
| "type": "string", | ||
| "description": "Search query (min 3 chars)", | ||
| "name": "q", | ||
| "in": "query", | ||
| "required": true | ||
| }, | ||
| { | ||
| "type": "integer", | ||
| "description": "Limit results (default 10, max 100)", | ||
| "name": "limit", | ||
| "in": "query" | ||
| } | ||
| ], | ||
| "responses": { | ||
| "200": { | ||
| "description": "OK", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/product.Product" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "400": { | ||
| "description": "Bad Request", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "401": { | ||
| "description": "Unauthorized", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "500": { | ||
| "description": "Internal Server Error", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "/products/{id}": { | ||
| "get": { | ||
| "security": [ | ||
| { | ||
| "Bearer": [] | ||
| } | ||
| ], | ||
| "description": "Get a single product by its ID", | ||
| "consumes": [ | ||
| "application/json" | ||
| ], | ||
| "produces": [ | ||
| "application/json" | ||
| ], | ||
| "tags": [ | ||
| "products" | ||
| ], | ||
| "summary": "Get product by ID", | ||
| "parameters": [ | ||
| { | ||
| "type": "string", | ||
| "description": "Product ID", | ||
| "name": "id", | ||
| "in": "path", | ||
| "required": true | ||
| } | ||
| ], | ||
| "responses": { | ||
| "200": { | ||
| "description": "OK", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "$ref": "#/definitions/product.Product" | ||
| } | ||
| } | ||
| }, | ||
| "400": { | ||
| "description": "Bad Request", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "401": { | ||
| "description": "Unauthorized", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "404": { | ||
| "description": "Not Found", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "500": { | ||
| "description": "Internal Server Error", | ||
| "schema": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "definitions": { | ||
| "product.Product": { | ||
| "type": "object", | ||
| "properties": { | ||
| "_id": { | ||
| "type": "string" | ||
| }, | ||
| "_keywords": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "allergens": { | ||
| "type": "string" | ||
| }, | ||
| "allergens_from_ingredients": { | ||
| "type": "string" | ||
| }, | ||
| "allergens_from_user": { | ||
| "type": "string" | ||
| }, | ||
| "allergens_hierarchy": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "allergens_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "brands": { | ||
| "type": "string" | ||
| }, | ||
| "brands_hierarchy": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "brands_lc": { | ||
| "type": "string" | ||
| }, | ||
| "brands_old": { | ||
| "type": "string" | ||
| }, | ||
| "brands_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "categories_properties": { | ||
| "type": "object" | ||
| }, | ||
| "categories_properties_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "checkers_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "code": { | ||
| "type": "string" | ||
| }, | ||
| "codes_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "complete": { | ||
| "type": "integer" | ||
| }, | ||
| "completeness": { | ||
| "type": "number" | ||
| }, | ||
| "countries": { | ||
| "type": "string" | ||
| }, | ||
| "countries_hierarchy": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "countries_lc": { | ||
| "type": "string" | ||
| }, | ||
| "countries_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "created_t": { | ||
| "type": "integer" | ||
| }, | ||
| "data_quality_info_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "data_quality_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "data_sources_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "ecoscore_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "entry_dates_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "environmental_score_data": { | ||
| "type": "object", | ||
| "properties": { | ||
| "adjustments": { | ||
| "type": "object", | ||
| "properties": { | ||
| "origins_of_ingredients": { | ||
| "type": "object", | ||
| "properties": { | ||
| "aggregated_origins": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "origin": { | ||
| "type": "string" | ||
| }, | ||
| "percent": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "epi_score": { | ||
| "type": "integer" | ||
| }, | ||
| "epi_value": { | ||
| "type": "integer" | ||
| }, | ||
| "origins_from_categories": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "origins_from_origins_field": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "transportation_scores": { | ||
| "type": "object", | ||
| "properties": { | ||
| "ad": { | ||
| "type": "number" | ||
| }, | ||
| "al": { | ||
| "type": "number" | ||
| }, | ||
| "at": { | ||
| "type": "number" | ||
| }, | ||
| "ax": { | ||
| "type": "number" | ||
| }, | ||
| "ba": { | ||
| "type": "number" | ||
| }, | ||
| "be": { | ||
| "type": "number" | ||
| }, | ||
| "bg": { | ||
| "type": "number" | ||
| }, | ||
| "ch": { | ||
| "type": "number" | ||
| }, | ||
| "cy": { | ||
| "type": "number" | ||
| }, | ||
| "cz": { | ||
| "type": "number" | ||
| }, | ||
| "de": { | ||
| "type": "number" | ||
| }, | ||
| "dk": { | ||
| "type": "number" | ||
| }, | ||
| "dz": { | ||
| "type": "number" | ||
| }, | ||
| "ee": { | ||
| "type": "number" | ||
| }, | ||
| "eg": { | ||
| "type": "number" | ||
| }, | ||
| "es": { | ||
| "type": "number" | ||
| }, | ||
| "fi": { | ||
| "type": "number" | ||
| }, | ||
| "fo": { | ||
| "type": "number" | ||
| }, | ||
| "fr": { | ||
| "type": "number" | ||
| }, | ||
| "gg": { | ||
| "type": "number" | ||
| }, | ||
| "gi": { | ||
| "type": "number" | ||
| }, | ||
| "gr": { | ||
| "type": "number" | ||
| }, | ||
| "hr": { | ||
| "type": "number" | ||
| }, | ||
| "hu": { | ||
| "type": "number" | ||
| }, | ||
| "ie": { | ||
| "type": "number" | ||
| }, | ||
| "il": { | ||
| "type": "number" | ||
| }, | ||
| "im": { | ||
| "type": "number" | ||
| }, | ||
| "is": { | ||
| "type": "number" | ||
| }, | ||
| "it": { | ||
| "type": "number" | ||
| }, | ||
| "je": { | ||
| "type": "number" | ||
| }, | ||
| "lb": { | ||
| "type": "number" | ||
| }, | ||
| "li": { | ||
| "type": "number" | ||
| }, | ||
| "lt": { | ||
| "type": "number" | ||
| }, | ||
| "lu": { | ||
| "type": "number" | ||
| }, | ||
| "lv": { | ||
| "type": "number" | ||
| }, | ||
| "ly": { | ||
| "type": "number" | ||
| }, | ||
| "ma": { | ||
| "type": "number" | ||
| }, | ||
| "mc": { | ||
| "type": "number" | ||
| }, | ||
| "md": { | ||
| "type": "number" | ||
| }, | ||
| "me": { | ||
| "type": "number" | ||
| }, | ||
| "mk": { | ||
| "type": "number" | ||
| }, | ||
| "mt": { | ||
| "type": "number" | ||
| }, | ||
| "nl": { | ||
| "type": "number" | ||
| }, | ||
| "no": { | ||
| "type": "number" | ||
| }, | ||
| "pl": { | ||
| "type": "number" | ||
| }, | ||
| "ps": { | ||
| "type": "number" | ||
| }, | ||
| "pt": { | ||
| "type": "number" | ||
| }, | ||
| "ro": { | ||
| "type": "number" | ||
| }, | ||
| "rs": { | ||
| "type": "number" | ||
| }, | ||
| "se": { | ||
| "type": "number" | ||
| }, | ||
| "si": { | ||
| "type": "number" | ||
| }, | ||
| "sj": { | ||
| "type": "number" | ||
| }, | ||
| "sk": { | ||
| "type": "number" | ||
| }, | ||
| "sm": { | ||
| "type": "number" | ||
| }, | ||
| "sy": { | ||
| "type": "number" | ||
| }, | ||
| "tn": { | ||
| "type": "number" | ||
| }, | ||
| "tr": { | ||
| "type": "number" | ||
| }, | ||
| "ua": { | ||
| "type": "number" | ||
| }, | ||
| "uk": { | ||
| "type": "number" | ||
| }, | ||
| "us": { | ||
| "type": "number" | ||
| }, | ||
| "va": { | ||
| "type": "number" | ||
| }, | ||
| "world": { | ||
| "type": "number" | ||
| }, | ||
| "xk": { | ||
| "type": "number" | ||
| } | ||
| } | ||
| }, | ||
| "transportation_values": { | ||
| "type": "object", | ||
| "properties": { | ||
| "ad": { | ||
| "type": "integer" | ||
| }, | ||
| "al": { | ||
| "type": "integer" | ||
| }, | ||
| "at": { | ||
| "type": "integer" | ||
| }, | ||
| "ax": { | ||
| "type": "integer" | ||
| }, | ||
| "ba": { | ||
| "type": "integer" | ||
| }, | ||
| "be": { | ||
| "type": "integer" | ||
| }, | ||
| "bg": { | ||
| "type": "integer" | ||
| }, | ||
| "ch": { | ||
| "type": "integer" | ||
| }, | ||
| "cy": { | ||
| "type": "integer" | ||
| }, | ||
| "cz": { | ||
| "type": "integer" | ||
| }, | ||
| "de": { | ||
| "type": "integer" | ||
| }, | ||
| "dk": { | ||
| "type": "integer" | ||
| }, | ||
| "dz": { | ||
| "type": "integer" | ||
| }, | ||
| "ee": { | ||
| "type": "integer" | ||
| }, | ||
| "eg": { | ||
| "type": "integer" | ||
| }, | ||
| "es": { | ||
| "type": "integer" | ||
| }, | ||
| "fi": { | ||
| "type": "integer" | ||
| }, | ||
| "fo": { | ||
| "type": "integer" | ||
| }, | ||
| "fr": { | ||
| "type": "integer" | ||
| }, | ||
| "gg": { | ||
| "type": "integer" | ||
| }, | ||
| "gi": { | ||
| "type": "integer" | ||
| }, | ||
| "gr": { | ||
| "type": "integer" | ||
| }, | ||
| "hr": { | ||
| "type": "integer" | ||
| }, | ||
| "hu": { | ||
| "type": "integer" | ||
| }, | ||
| "ie": { | ||
| "type": "integer" | ||
| }, | ||
| "il": { | ||
| "type": "integer" | ||
| }, | ||
| "im": { | ||
| "type": "integer" | ||
| }, | ||
| "is": { | ||
| "type": "integer" | ||
| }, | ||
| "it": { | ||
| "type": "integer" | ||
| }, | ||
| "je": { | ||
| "type": "integer" | ||
| }, | ||
| "lb": { | ||
| "type": "integer" | ||
| }, | ||
| "li": { | ||
| "type": "integer" | ||
| }, | ||
| "lt": { | ||
| "type": "integer" | ||
| }, | ||
| "lu": { | ||
| "type": "integer" | ||
| }, | ||
| "lv": { | ||
| "type": "integer" | ||
| }, | ||
| "ly": { | ||
| "type": "integer" | ||
| }, | ||
| "ma": { | ||
| "type": "integer" | ||
| }, | ||
| "mc": { | ||
| "type": "integer" | ||
| }, | ||
| "md": { | ||
| "type": "integer" | ||
| }, | ||
| "me": { | ||
| "type": "integer" | ||
| }, | ||
| "mk": { | ||
| "type": "integer" | ||
| }, | ||
| "mt": { | ||
| "type": "integer" | ||
| }, | ||
| "nl": { | ||
| "type": "integer" | ||
| }, | ||
| "no": { | ||
| "type": "integer" | ||
| }, | ||
| "pl": { | ||
| "type": "integer" | ||
| }, | ||
| "ps": { | ||
| "type": "integer" | ||
| }, | ||
| "pt": { | ||
| "type": "integer" | ||
| }, | ||
| "ro": { | ||
| "type": "integer" | ||
| }, | ||
| "rs": { | ||
| "type": "integer" | ||
| }, | ||
| "se": { | ||
| "type": "integer" | ||
| }, | ||
| "si": { | ||
| "type": "integer" | ||
| }, | ||
| "sj": { | ||
| "type": "integer" | ||
| }, | ||
| "sk": { | ||
| "type": "integer" | ||
| }, | ||
| "sm": { | ||
| "type": "integer" | ||
| }, | ||
| "sy": { | ||
| "type": "integer" | ||
| }, | ||
| "tn": { | ||
| "type": "integer" | ||
| }, | ||
| "tr": { | ||
| "type": "integer" | ||
| }, | ||
| "ua": { | ||
| "type": "integer" | ||
| }, | ||
| "uk": { | ||
| "type": "integer" | ||
| }, | ||
| "us": { | ||
| "type": "integer" | ||
| }, | ||
| "va": { | ||
| "type": "integer" | ||
| }, | ||
| "world": { | ||
| "type": "integer" | ||
| }, | ||
| "xk": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| }, | ||
| "values": { | ||
| "type": "object", | ||
| "properties": { | ||
| "ad": { | ||
| "type": "integer" | ||
| }, | ||
| "al": { | ||
| "type": "integer" | ||
| }, | ||
| "at": { | ||
| "type": "integer" | ||
| }, | ||
| "ax": { | ||
| "type": "integer" | ||
| }, | ||
| "ba": { | ||
| "type": "integer" | ||
| }, | ||
| "be": { | ||
| "type": "integer" | ||
| }, | ||
| "bg": { | ||
| "type": "integer" | ||
| }, | ||
| "ch": { | ||
| "type": "integer" | ||
| }, | ||
| "cy": { | ||
| "type": "integer" | ||
| }, | ||
| "cz": { | ||
| "type": "integer" | ||
| }, | ||
| "de": { | ||
| "type": "integer" | ||
| }, | ||
| "dk": { | ||
| "type": "integer" | ||
| }, | ||
| "dz": { | ||
| "type": "integer" | ||
| }, | ||
| "ee": { | ||
| "type": "integer" | ||
| }, | ||
| "eg": { | ||
| "type": "integer" | ||
| }, | ||
| "es": { | ||
| "type": "integer" | ||
| }, | ||
| "fi": { | ||
| "type": "integer" | ||
| }, | ||
| "fo": { | ||
| "type": "integer" | ||
| }, | ||
| "fr": { | ||
| "type": "integer" | ||
| }, | ||
| "gg": { | ||
| "type": "integer" | ||
| }, | ||
| "gi": { | ||
| "type": "integer" | ||
| }, | ||
| "gr": { | ||
| "type": "integer" | ||
| }, | ||
| "hr": { | ||
| "type": "integer" | ||
| }, | ||
| "hu": { | ||
| "type": "integer" | ||
| }, | ||
| "ie": { | ||
| "type": "integer" | ||
| }, | ||
| "il": { | ||
| "type": "integer" | ||
| }, | ||
| "im": { | ||
| "type": "integer" | ||
| }, | ||
| "is": { | ||
| "type": "integer" | ||
| }, | ||
| "it": { | ||
| "type": "integer" | ||
| }, | ||
| "je": { | ||
| "type": "integer" | ||
| }, | ||
| "lb": { | ||
| "type": "integer" | ||
| }, | ||
| "li": { | ||
| "type": "integer" | ||
| }, | ||
| "lt": { | ||
| "type": "integer" | ||
| }, | ||
| "lu": { | ||
| "type": "integer" | ||
| }, | ||
| "lv": { | ||
| "type": "integer" | ||
| }, | ||
| "ly": { | ||
| "type": "integer" | ||
| }, | ||
| "ma": { | ||
| "type": "integer" | ||
| }, | ||
| "mc": { | ||
| "type": "integer" | ||
| }, | ||
| "md": { | ||
| "type": "integer" | ||
| }, | ||
| "me": { | ||
| "type": "integer" | ||
| }, | ||
| "mk": { | ||
| "type": "integer" | ||
| }, | ||
| "mt": { | ||
| "type": "integer" | ||
| }, | ||
| "nl": { | ||
| "type": "integer" | ||
| }, | ||
| "no": { | ||
| "type": "integer" | ||
| }, | ||
| "pl": { | ||
| "type": "integer" | ||
| }, | ||
| "ps": { | ||
| "type": "integer" | ||
| }, | ||
| "pt": { | ||
| "type": "integer" | ||
| }, | ||
| "ro": { | ||
| "type": "integer" | ||
| }, | ||
| "rs": { | ||
| "type": "integer" | ||
| }, | ||
| "se": { | ||
| "type": "integer" | ||
| }, | ||
| "si": { | ||
| "type": "integer" | ||
| }, | ||
| "sj": { | ||
| "type": "integer" | ||
| }, | ||
| "sk": { | ||
| "type": "integer" | ||
| }, | ||
| "sm": { | ||
| "type": "integer" | ||
| }, | ||
| "sy": { | ||
| "type": "integer" | ||
| }, | ||
| "tn": { | ||
| "type": "integer" | ||
| }, | ||
| "tr": { | ||
| "type": "integer" | ||
| }, | ||
| "ua": { | ||
| "type": "integer" | ||
| }, | ||
| "uk": { | ||
| "type": "integer" | ||
| }, | ||
| "us": { | ||
| "type": "integer" | ||
| }, | ||
| "va": { | ||
| "type": "integer" | ||
| }, | ||
| "world": { | ||
| "type": "integer" | ||
| }, | ||
| "xk": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| }, | ||
| "warning": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "packaging": { | ||
| "type": "object", | ||
| "properties": { | ||
| "value": { | ||
| "type": "integer" | ||
| }, | ||
| "warning": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "production_system": { | ||
| "type": "object", | ||
| "properties": { | ||
| "labels": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "value": { | ||
| "type": "integer" | ||
| }, | ||
| "warning": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "threatened_species": { | ||
| "type": "object", | ||
| "properties": { | ||
| "warning": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "agribalyse": { | ||
| "type": "object", | ||
| "properties": { | ||
| "warning": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "grade": { | ||
| "type": "string" | ||
| }, | ||
| "missing": { | ||
| "type": "object", | ||
| "properties": { | ||
| "categories": { | ||
| "type": "integer" | ||
| }, | ||
| "ingredients": { | ||
| "type": "integer" | ||
| }, | ||
| "labels": { | ||
| "type": "integer" | ||
| }, | ||
| "origins": { | ||
| "type": "integer" | ||
| }, | ||
| "packagings": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| }, | ||
| "missing_agribalyse_match_warning": { | ||
| "type": "integer" | ||
| }, | ||
| "missing_key_data": { | ||
| "type": "integer" | ||
| }, | ||
| "status": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "environmental_score_grade": { | ||
| "type": "string" | ||
| }, | ||
| "environmental_score_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "food_groups_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "id": { | ||
| "type": "string" | ||
| }, | ||
| "informers_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "lang": { | ||
| "type": "string" | ||
| }, | ||
| "languages_hierarchy": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "languages_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "last_edit_dates_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "last_modified_t": { | ||
| "type": "integer" | ||
| }, | ||
| "last_updated_t": { | ||
| "type": "integer" | ||
| }, | ||
| "lc": { | ||
| "type": "string" | ||
| }, | ||
| "main_countries_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "max_imgid": { | ||
| "type": "string" | ||
| }, | ||
| "misc_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "no_nutrition_data": { | ||
| "type": "string" | ||
| }, | ||
| "nova_group_debug": { | ||
| "type": "string" | ||
| }, | ||
| "nova_groups_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "nutrient_levels": { | ||
| "type": "object" | ||
| }, | ||
| "nutriments": { | ||
| "type": "object", | ||
| "properties": { | ||
| "carbohydrates": { | ||
| "type": "number" | ||
| }, | ||
| "carbohydrates_100g": { | ||
| "type": "number" | ||
| }, | ||
| "carbohydrates_serving": { | ||
| "type": "number" | ||
| }, | ||
| "carbohydrates_unit": { | ||
| "type": "string" | ||
| }, | ||
| "carbohydrates_value": { | ||
| "type": "number" | ||
| }, | ||
| "energy": { | ||
| "type": "number" | ||
| }, | ||
| "energy-kcal": { | ||
| "type": "number" | ||
| }, | ||
| "energy-kcal_100g": { | ||
| "type": "number" | ||
| }, | ||
| "energy-kcal_serving": { | ||
| "type": "number" | ||
| }, | ||
| "energy-kcal_unit": { | ||
| "type": "string" | ||
| }, | ||
| "energy-kcal_value": { | ||
| "type": "number" | ||
| }, | ||
| "energy-kcal_value_computed": { | ||
| "type": "number" | ||
| }, | ||
| "energy_100g": { | ||
| "type": "number" | ||
| }, | ||
| "energy_serving": { | ||
| "type": "number" | ||
| }, | ||
| "energy_unit": { | ||
| "type": "string" | ||
| }, | ||
| "energy_value": { | ||
| "type": "number" | ||
| }, | ||
| "fat": { | ||
| "type": "number" | ||
| }, | ||
| "fat_100g": { | ||
| "type": "number" | ||
| }, | ||
| "fat_serving": { | ||
| "type": "number" | ||
| }, | ||
| "fat_unit": { | ||
| "type": "string" | ||
| }, | ||
| "fat_value": { | ||
| "type": "number" | ||
| }, | ||
| "fruits-vegetables-legumes-estimate-from-ingredients_100g": { | ||
| "type": "number" | ||
| }, | ||
| "fruits-vegetables-legumes-estimate-from-ingredients_serving": { | ||
| "type": "number" | ||
| }, | ||
| "fruits-vegetables-nuts-estimate-from-ingredients_100g": { | ||
| "type": "number" | ||
| }, | ||
| "fruits-vegetables-nuts-estimate-from-ingredients_serving": { | ||
| "type": "number" | ||
| }, | ||
| "monounsaturated-fat": { | ||
| "type": "number" | ||
| }, | ||
| "monounsaturated-fat_100g": { | ||
| "type": "number" | ||
| }, | ||
| "monounsaturated-fat_serving": { | ||
| "type": "number" | ||
| }, | ||
| "monounsaturated-fat_unit": { | ||
| "type": "string" | ||
| }, | ||
| "monounsaturated-fat_value": { | ||
| "type": "number" | ||
| }, | ||
| "nova-group": { | ||
| "type": "number" | ||
| }, | ||
| "nova-group_100g": { | ||
| "type": "number" | ||
| }, | ||
| "nova-group_serving": { | ||
| "type": "number" | ||
| }, | ||
| "nutrition-score-fr": { | ||
| "type": "number" | ||
| }, | ||
| "nutrition-score-fr_100g": { | ||
| "type": "number" | ||
| }, | ||
| "polyunsaturated-fat": { | ||
| "type": "number" | ||
| }, | ||
| "polyunsaturated-fat_100g": { | ||
| "type": "number" | ||
| }, | ||
| "polyunsaturated-fat_serving": { | ||
| "type": "number" | ||
| }, | ||
| "polyunsaturated-fat_unit": { | ||
| "type": "string" | ||
| }, | ||
| "polyunsaturated-fat_value": { | ||
| "type": "number" | ||
| }, | ||
| "proteins": { | ||
| "type": "number" | ||
| }, | ||
| "proteins_100g": { | ||
| "type": "number" | ||
| }, | ||
| "proteins_serving": { | ||
| "type": "number" | ||
| }, | ||
| "proteins_unit": { | ||
| "type": "string" | ||
| }, | ||
| "proteins_value": { | ||
| "type": "number" | ||
| }, | ||
| "salt": { | ||
| "type": "number" | ||
| }, | ||
| "salt_100g": { | ||
| "type": "number" | ||
| }, | ||
| "salt_serving": { | ||
| "type": "number" | ||
| }, | ||
| "salt_unit": { | ||
| "type": "string" | ||
| }, | ||
| "salt_value": { | ||
| "type": "number" | ||
| }, | ||
| "saturated-fat": { | ||
| "type": "number" | ||
| }, | ||
| "saturated-fat_100g": { | ||
| "type": "number" | ||
| }, | ||
| "saturated-fat_serving": { | ||
| "type": "number" | ||
| }, | ||
| "saturated-fat_unit": { | ||
| "type": "string" | ||
| }, | ||
| "saturated-fat_value": { | ||
| "type": "number" | ||
| }, | ||
| "sodium": { | ||
| "type": "number" | ||
| }, | ||
| "sodium_100g": { | ||
| "type": "number" | ||
| }, | ||
| "sodium_serving": { | ||
| "type": "number" | ||
| }, | ||
| "sodium_unit": { | ||
| "type": "string" | ||
| }, | ||
| "sodium_value": { | ||
| "type": "number" | ||
| }, | ||
| "trans-fat": { | ||
| "type": "number" | ||
| }, | ||
| "trans-fat_100g": { | ||
| "type": "number" | ||
| }, | ||
| "trans-fat_serving": { | ||
| "type": "number" | ||
| }, | ||
| "trans-fat_unit": { | ||
| "type": "string" | ||
| }, | ||
| "trans-fat_value": { | ||
| "type": "number" | ||
| } | ||
| } | ||
| }, | ||
| "nutriscore": { | ||
| "type": "object", | ||
| "properties": { | ||
| "2021": { | ||
| "type": "object", | ||
| "properties": { | ||
| "category_available": { | ||
| "type": "integer" | ||
| }, | ||
| "data": { | ||
| "type": "object", | ||
| "properties": { | ||
| "energy": { | ||
| "type": "integer" | ||
| }, | ||
| "fiber": { | ||
| "type": "integer" | ||
| }, | ||
| "fruits_vegetables_nuts_colza_walnut_olive_oils": { | ||
| "type": "integer" | ||
| }, | ||
| "is_beverage": { | ||
| "type": "integer" | ||
| }, | ||
| "is_cheese": { | ||
| "type": "integer" | ||
| }, | ||
| "is_fat": { | ||
| "type": "integer" | ||
| }, | ||
| "is_water": { | ||
| "type": "integer" | ||
| }, | ||
| "proteins": { | ||
| "type": "integer" | ||
| }, | ||
| "saturated_fat": { | ||
| "type": "integer" | ||
| }, | ||
| "saturated_fat_ratio": { | ||
| "type": "integer" | ||
| }, | ||
| "sodium": {}, | ||
| "sugars": { | ||
| "type": "number" | ||
| } | ||
| } | ||
| }, | ||
| "grade": { | ||
| "type": "string" | ||
| }, | ||
| "nutrients_available": { | ||
| "type": "integer" | ||
| }, | ||
| "nutriscore_applicable": { | ||
| "type": "integer" | ||
| }, | ||
| "nutriscore_computed": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| }, | ||
| "2023": { | ||
| "type": "object", | ||
| "properties": { | ||
| "category_available": { | ||
| "type": "integer" | ||
| }, | ||
| "data": { | ||
| "type": "object", | ||
| "properties": { | ||
| "energy": { | ||
| "type": "integer" | ||
| }, | ||
| "fiber": {}, | ||
| "fruits_vegetables_legumes": {}, | ||
| "is_beverage": { | ||
| "type": "integer" | ||
| }, | ||
| "is_cheese": { | ||
| "type": "integer" | ||
| }, | ||
| "is_fat_oil_nuts_seeds": { | ||
| "type": "integer" | ||
| }, | ||
| "is_red_meat_product": { | ||
| "type": "integer" | ||
| }, | ||
| "is_water": { | ||
| "type": "integer" | ||
| }, | ||
| "proteins": { | ||
| "type": "integer" | ||
| }, | ||
| "salt": {}, | ||
| "saturated_fat": { | ||
| "type": "integer" | ||
| }, | ||
| "saturated_fat_ratio": { | ||
| "type": "integer" | ||
| }, | ||
| "sugars": { | ||
| "type": "number" | ||
| } | ||
| } | ||
| }, | ||
| "grade": { | ||
| "type": "string" | ||
| }, | ||
| "nutrients_available": { | ||
| "type": "integer" | ||
| }, | ||
| "nutriscore_applicable": { | ||
| "type": "integer" | ||
| }, | ||
| "nutriscore_computed": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "nutriscore_2021_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "nutriscore_2023_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "nutriscore_grade": { | ||
| "type": "string" | ||
| }, | ||
| "nutriscore_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "nutriscore_version": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_data": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_data_per": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_data_prepared_per": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_grade_fr": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_grades": { | ||
| "type": "string" | ||
| }, | ||
| "nutrition_grades_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "nutrition_score_beverage": { | ||
| "type": "integer" | ||
| }, | ||
| "nutrition_score_warning_no_fiber": { | ||
| "type": "integer" | ||
| }, | ||
| "nutrition_score_warning_no_fruits_vegetables_nuts": { | ||
| "type": "integer" | ||
| }, | ||
| "packaging_materials_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "packaging_recycling_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "packagings": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "packagings_materials": { | ||
| "type": "object" | ||
| }, | ||
| "pnns_groups_1": { | ||
| "type": "string" | ||
| }, | ||
| "pnns_groups_1_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "pnns_groups_2": { | ||
| "type": "string" | ||
| }, | ||
| "pnns_groups_2_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "popularity_key": { | ||
| "type": "integer" | ||
| }, | ||
| "popularity_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "product_name": { | ||
| "type": "string" | ||
| }, | ||
| "product_name_de": { | ||
| "type": "string" | ||
| }, | ||
| "product_quantity": { | ||
| "type": "number" | ||
| }, | ||
| "product_type": { | ||
| "type": "string" | ||
| }, | ||
| "quantity": { | ||
| "type": "string" | ||
| }, | ||
| "rev": { | ||
| "type": "integer" | ||
| }, | ||
| "scans_n": { | ||
| "type": "integer" | ||
| }, | ||
| "serving_quantity": { | ||
| "type": "number" | ||
| }, | ||
| "serving_quantity_unit": { | ||
| "type": "string" | ||
| }, | ||
| "serving_size": { | ||
| "type": "string" | ||
| }, | ||
| "states": { | ||
| "type": "string" | ||
| }, | ||
| "states_tags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "traces": { | ||
| "type": "string" | ||
| }, | ||
| "traces_from_ingredients": { | ||
| "type": "string" | ||
| }, | ||
| "traces_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "unique_scans_n": { | ||
| "type": "integer" | ||
| }, | ||
| "unknown_nutrients_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "weighers_tags": { | ||
| "type": "array", | ||
| "items": {} | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "securityDefinitions": { | ||
| "Bearer": { | ||
| "type": "apiKey", | ||
| "name": "Authorization", | ||
| "in": "header" | ||
| } | ||
| } | ||
| }` | ||
|
|
||
| // SwaggerInfo holds exported Swagger Info so clients can modify it | ||
| var SwaggerInfo = &swag.Spec{ | ||
| Version: "1.0", | ||
| Host: "localhost:80", | ||
| BasePath: "/api/v1", | ||
| Schemes: []string{}, | ||
| Title: "Database API Wrapper", | ||
| Description: "API for accessing the SnackLog product database.", | ||
| InfoInstanceName: "swagger", | ||
| SwaggerTemplate: docTemplate, | ||
| LeftDelim: "{{", | ||
| RightDelim: "}}", | ||
| } | ||
|
|
||
| func init() { | ||
| swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
| } |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generated Swagger documentation files (docs/docs.go, docs/swagger.json, docs/swagger.yaml) are being committed to the repository. These files are auto-generated by the swag tool and are typically excluded from version control (added to .gitignore) and regenerated during the build process. Consider adding the docs directory to .gitignore and generating these files as part of the build/deployment pipeline instead.
main.go
Outdated
| // @contact.name API Support | ||
| // @contact.url http://www.swagger.io/support | ||
| // @contact.email support@swagger.io |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contact information is using generic Swagger.io placeholders (API Support, support@swagger.io, http://www.swagger.io/support). These should be updated to reflect the actual SnackLog project contact details or team information.
| // @contact.name API Support | |
| // @contact.url http://www.swagger.io/support | |
| // @contact.email support@swagger.io | |
| // @contact.name SnackLog Team | |
| // @contact.url https://snacklog.com/support | |
| // @contact.email support@snacklog.com |
main.go
Outdated
| // @title Database API Wrapper | ||
| // @version 1.0 | ||
| // @description API for accessing the SnackLog product database. | ||
| // @termsOfService http://swagger.io/terms/ |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The terms of service URL points to a generic Swagger.io placeholder (http://swagger.io/terms/). This should be updated to either the actual SnackLog terms of service URL or removed if not applicable.
| // @termsOfService http://swagger.io/terms/ |
main.go
Outdated
| // @license.name Apache 2.0 | ||
| // @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
|
||
| // @host localhost:80 |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host is hardcoded to 'localhost:80', which is not suitable for production or different deployment environments. Consider using an environment variable or configuration value for the host, or use a placeholder that can be dynamically set based on deployment context.
| // @host localhost:80 |
| // @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
|
||
| // @host localhost:80 | ||
| // @BasePath /api/v1 |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BasePath is set to '/api/v1', but looking at the router setup in setupRouter and setupEndpoints, the actual routes are registered under '/products' (e.g., '/products/search', '/products/:id'), not '/api/v1/products'. This mismatch means the Swagger documentation will show incorrect endpoint paths. Either the BasePath should be removed or the router should be updated to include the '/api/v1' prefix.
| // @BasePath /api/v1 |
No description provided.