Meta tags:
description= Automatically generate RESTful API documentation with Swagger 2.0 for Go. - swaggo/swag;
Headings (most frequently used words):
to, use, type, uh, oh, add, swag, struct, of, navigation, how, the, types, multiple, enum, code, saved, searches, and, files, supported, with, api, info, security, about, contributors, license, packages, footer, descriptions, model, response, headers, description, tag, custom, field, generate, search, repositories, users, issues, pull, requests, provide, feedback, swaggo, declarative, comments, format, menu, filter, your, results, more, quickly, folders, latest, commit, history, repository, contents, getting, started, cli, web, frameworks, it, gin, formatter, implementation, status, general, operation, mime, param, data, attribute, examples, project, backers, sponsors, releases, 55, languages, using, markdown, available, future, over, lines, user, defined, structure, an, array, function, scoped, declaration, composition, in, request, path, params, paths, example, value, schemaexample, body, swaggertype, global, overrides, support, swaggerignore, exclude, extension, rename, display, annotations, from, constants, for, items, only, specific, docs, file, generics, change, default, go, template, action, delimiters, parse, internal, dependency, topics, resources, conduct, contributing, stars, watchers, forks,
Text of the page (most frequently used words):
the (141), string (70), type (64), name (64), #description (63), json (61), api (54), default (52), #swagger (50), example (48), swag (47), value (47), and (41), for (36), struct (36), this (35), you (32), use (32), docs (31), types (31), tag (31), with (30), param (30), code (29), format (27), http (24), object (23), accounts (23), can (22), github (22), files (22), int (22), account (22), security (21), file (21), false (21), url (20), that (19), license (19), all (19), https (19), must (19), data (19), query (19), support (18), success (18), path (18), your (17), see (17), separated (17), add (17), application (17), html (17), contact (16), parse (16), gin (16), 200 (15), enums (15), securitydefinitions (15), response (15), will (14), from (14), swaggo (14), version (14), jsonresult (14), org (14), schema (14), main (13), only (13), com (13), oauth2 (13), info (13), model (13), failure (13), validation (13), mime (13), httputil (13), init (12), request (12), comment (12), operation (12), true (12), array (12), err (12), get (12), tools (12), documentation (11), package (11), generated (11), order (11), general (11), comments (11), user (11), proto (11), ietf (11), draft (11), fge (11), section (11), markdown (11), fmt (11), generate (10), field (10), integer (10), multiple (10), tags (10), swaggertype (10), key (10), email (10), body (10), required (10), ctx (10), error (9), annotations (9), web (9), defined (9), post (9), func (9), which (9), write (9), yaml (9), return (9), router (9), header (9), folder (9), list (9), title (9), httperror (9), reload (8), project (8), fields (8), examples (8), like (8), set (8), desc (8), scope (8), exclude (8), using (8), foo (8), www (8), search (8), produce (8), accept (8), import (8), disabled (8), not (7), page (7), packages (7), image (7), comma (7), basic (7), doc (7), extension (7), number (7), parameters (7), parameter (7), values (7), server (7), collection (7), controller (7), host (7), swaggerinfo (7), view (7), time (6), information (6), there (6), was (6), please (6), custom (6), source (6), dependency (6), make (6), are (6), how (6), short (6), enum (6), difficulty (6), override (6), tokenurl (6), extensions (6), when (6), sql (6), used (6), nil (6), bin (6), message (6), descriptions (6), bar (6), options (6), auth (6), stream (6), summary (6), spaces (6), apis (6), operations (6), celler (6), externaldocs (6), apache (6), run (6), enterprise (6), navigation (5), while (5), loading (5), latest (5), contributing (5), resources (5), usage (5), output (5), have (5), apikeyauth (5), read (5), start (5), any (5), byte (5), address (5), 400 (5), function (5), csv (5), optional (5), annotation (5), take (5), open (5), external (5), listaccounts (5), community (4), terms (4), other (4), properties (4), readme (4), automatically (4), show (4), here (4), licenses (4), frameworks (4), parsedependency (4), want (4), both (4), internal (4), delimiters (4), more (4), details (4), genericnestedresponse (4), command (4), specific (4), class (4), need (4), one (4), first (4), const (4), each (4), oauth2application (4), access (4), oauth (4), token (4), follows (4), swaggerignore (4), note (4), possible (4), nullint64 (4), another (4), u3dhz2dlcibyb2nrcw (4), base64 (4), primitive (4), timestamptime (4), strconv (4), supported (4), test (4), put (4), group_id (4), group (4), headers (4), valid (4), multi (4), tab (4), authorizationurl (4), text (4), described (4), under (4), document (4), basepath (4), 8080 (4), formatter (4), directories (4), help (4), state (4), actions (4), issues (4), status (3), stars (3), conduct (3), openapi (3), topics (3), about (3), our (3), but (3), has (3), parseinternal (3), include (3), new (3), delimiter (3), generation (3), change (3), template (3), generics (3), would (3), outputtypes (3), items (3), medium (3), constants (3), admin (3), grants (3), basicauth (3), omitempty (3), nullable (3), paths (3), named (3), same (3), skip (3), replace (3), database (3), nullstring (3), global (3), overrides (3), crt (3), via (3), interface (3), parser (3), attribute (3), schemaexample (3), user_id (3), params (3), deepobject (3), also (3), myhandler (3), inside (3), structure (3), lines (3), baz (3), collectionformat (3), minlength (3), maxlength (3), minimum (3), maximum (3), available (3), password (3), implicit (3), form (3), deprecated (3), patch (3), schemes (3), base (3), localhost (3), termsofservice (3), sample (3), declarative (3), describing (3), context (3), 500 (3), 404 (3), find (3), app (3), newerror (3), showaccount (3), ginswagger (3), getting (3), started (3), cmd (3), commit (3), insights (3), pull (3), requests (3), signed (3), settings (3), window (3), refresh (3), session (3), sign (3), saved (3), feedback (3), grade (3), features (3), copilot (3), platform (3), solutions (3), explore (3), action (2), manage (2), footer (2), 2026 (2), contributors (2), releases (2), repository (2), forks (2), 13k (2), mit (2), restful (2), sponsor (2), become (2), sponsors (2), backers (2), exists (2), contribute (2), added (2), variety (2), gopher (2), work (2), 201 (2), limit (2), flag (2), different (2), asc (2), ordered (2), just (2), second (2), iota (2), hard (2), variant (2), easy (2), works (2), condition (2), rename (2), display (2), def (2), abc (2), mystruct (2), provided (2), directory (2), overridesfile (2), may (2), coeffs (2), overridden (2), specifying (2), unix (2), userid (2), username (2), jpg (2), groups (2), account_id (2), token2 (2), entity (2), myheader (2), data2 (2), data1 (2), overriding (2), uint (2), composition (2), naming (2), scoped (2), declaration (2), line (2), over (2), boolean (2), declares (2), determines (2), instances (2), formdata (2), pipes (2), tsv (2), ssv (2), results (2), 100 (2), mark (2), accesscode (2), apikey (2), event (2), gif (2), jpeg (2), png (2), octet (2), urlencoded (2), plain (2), xml (2), accepts (2), correct (2), some (2), then (2), consume (2), affects (2), such (2), unique (2), alternative (2), provides (2), images (2), following (2), authentication (2), implementation (2), existing (2), ensure (2), formatting (2), after (2), statusok (2), statusnotfound (2), godoc (2), aid (2), gonic (2), net (2), handler (2), swaggerfiles (2), wraphandler (2), middleware (2), petstore (2), programmatically (2), cli (2), chi (2), arguments (2), dir (2), searching (2), generalinfo (2), written (2), create (2), quiet (2), camelcase (2), containing (2), filter (2), provide (2), root (2), case (2), docker (2), build (2), install (2), quickly (2), integrate (2), utils_test (2), utils (2), swagger_test (2), spec_test (2), spec (2), schema_test (2), parsergopackages (2), parser_test (2), packages_test (2), operation_test (2), golist_test (2), golist (2), sum (2), mod (2), generics_test (2), formatter_test (2), field_parser_test (2), field_parser (2), enums_test (2), readme_zh (2), readme_pt (2), pull_request_template (2), makefile (2), dockerfile (2), code_of_conduct (2), goreleaser (2), yml (2), gitignore (2), testdata (2), gen (2), assets (2), 903 (2), commits (2), last (2), menu (2), quality (2), projects (2), discussions (2), appearance (2), cancel (2), searches (2), repositories (2), business (2), advanced (2), developer (2), customer (2), services (2), devops (2), perform, share, personal, cookies, privacy, inc, languages, jan, rc5, report, watching, 161, watchers, activity, swagger2, golang, becoming, logo, link, website, thank, backer, thanks, people, who, inspired, simplified, creative, commons, licensing, tenntenn, stickers, yvasiyarov, dependencies, flags, right, left, properly, contain, most, likely, fail, these, templates, 1177, 980, responsewriter, getposts, genericinnertype, 204, anotherone, should, complete, generates, specification, three, descending, ascending, sort, answers, questions, quiz, consts, thirdclass, third, rules, apply, above, firstclass, harddifficulty, mediumdifficulty, manually, firebase, administrative, resp, ignored, rendered, full, prevent, problems, define, directives, beginning, don, passing, mapping, tell, place, wherever, appears, present, current, mybinding, certicatekeypair, 379, big, float, prim_type, register_time, registertime, simply, parseint, unmarshaljson, appendint, marshaljson, implement, encoding, marshaler, handles, starting, writes, 708, rfc822, subject, testmail, nbody, photo_urls, photourls, location, deep, level, data4, data3, objects, nested, responsefield, requestfield, declare, structs, follow, convention, forth, spanning, either, routes, definitions, uniqueitems, minitems, maxitems, pattern, future, corresponds, instead, single, instance, pipe, tbar, space, extending, previously, mentioned, further, formats, multipleof, none, count, control, per, might, supplied, client, meaning, unlike, conform, option, validate, qux, random, enumnumber, enumint, enumstring, protects, endpoints, hoge, authorize, authorization, oauth2accesscode, oauth2password, oauth2implicit, uploading, bool, float32, uint32, uint64, vnd, multipart, mpfd, alias, match, besides, aliases, endpoint, given, codesample, deprecatedrouter, definition, httpmethod, mandatory, what, does, commas, identify, among, load, verbose, explanation, behavior, tagname, needed, parses, parsed, insufficient, things, transfer, protocol, served, serving, person, organization, pointing, exposed, service, best, cool, grouping, upload, adding, keys, responses, lists, due, indenting, tabs, allowed, standard, formatted, result, browse, documents, shown, below, index, accountsall, accountone, statusbadrequest, atoi, serve, additionally, dynamically, exports, variable, uploadaccountimage, updateaccount, deleteaccount, delete, addaccount, newcontroller, embed, finish, steps, hertz, atreugo, fiber, flamingo, gorilla, mux, buffalo, echo, logger, propertystrategy, property, strategy, snakecase, pascalcase, parsevendor, parsedependencylevel, pdl, enhancement, models, markdownfiles, codeexamplefiles, cef, codesamples, generatedtime, timestamp, top, parsedepth, depth, requiredbydefault, instancename, parsegolist, special, prefixed, character, excluded, templatedelims, leftdelim, rightdelim, initial, parsefuncbody, within, functions, machine, hoststate, vendor, upgrade, module, sure, configuration, gets, live, let, know, contains, download, pre, compiled, binary, release, ghcr, pwd, alternatively, newer, generic, contents, converts, created, plugins, popular, allows, português, 简体中文, english, history, date, folders, branches, master, additional, 401, star, fork, notification, notifications, public, dismiss, alert, switched, out, resetting, focus, qualifiers, submit, contacted, every, piece, input, very, seriously, syntax, tips, clear, users, jump, pricing, premium, ons, powered, collections, trending, archive, program, accelerator, maintainer, lab, programs, fund, developers, partners, trust, center, forum, skills, ebooks, reports, events, webinars, stories, software, development, topic, industries, government, manufacturing, financial, healthcare, industry, cases, devsecops, modernization, nonprofits, startups, small, teams, enterprises, company, size, marketplace, changelog, blog, why, stop, leaks, before, they, secret, protection, secure, fix, vulnerabilities, changes, review, plan, track, instant, dev, environments, codespaces, automate, workflow, workflows, mcp, registry, direct, agents, issue, merge, better, creation, toggle, content,
Text of the page (random words):
est go swagger_test go types go types go utils go utils go utils_test go utils_test go version go version go view all files repository files navigation readme code of conduct contributing mit license more items swag english 简体中文 português swag converts go annotations to swagger documentation 2 0 we ve created a variety of plugins for popular go web frameworks this allows you to quickly integrate with an existing go project using swagger ui contents getting started supported web frameworks how to use it with gin the swag formatter implementation status declarative comments format general api info api operation security examples descriptions over multiple lines user defined structure with an array type function scoped struct declaration model composition in response add request headers add response headers use multiple path params example value of struct schemaexample of body description of struct use swaggertype tag to supported custom type use global overrides to support a custom type use swaggerignore tag to exclude a field add extension info to struct field rename model to display how to use security annotations add a description for enum items generate only specific docs file types how to use go generic types about the project getting started add comments to your api source code see declarative comments format install swag by using go install github com swaggo swag cmd swag latest to build from source you need go 1 19 or newer alternatively you can run the docker image docker run rm v pwd code ghcr io swaggo swag latest or download a pre compiled binary from the release page run swag init in the project s root folder which contains the main go file this will parse your comments and generate the required files docs folder and docs docs go swag init make sure to import the generated docs docs go so that your specific configuration gets init ed if your general api annotations do not live in main go you can let swag know with g flag import _ example module name docs swag init g http api go optional use swag fmt format the swag comment please upgrade to the latest version swag fmt swag cli swag init h name swag init create docs go usage swag init command options arguments options quiet q make the logger quiet default false generalinfo value g value go file path in which swagger general api info is written default main go dir value d value directories you want to parse comma separated and general info file must be in the first one default exclude value exclude directories and files when searching comma separated propertystrategy value p value property naming strategy like snakecase camelcase pascalcase default camelcase output value o value output directory for all the generated files swagger json swagger yaml and docs go default docs outputtypes value ot value output types of generated files docs go swagger json swagger yaml like go json yaml default go json yaml parsevendor parse go files in vendor folder disabled by default default false parsedependency pd parse go files inside dependency folder disabled by default default false parsedependencylevel pdl enhancement of parsedependency parse go files inside dependency folder 0 disabled 1 only parse models 2 only parse operations 3 parse all default 0 markdownfiles value md value parse folder containing markdown files to use as description disabled by default codeexamplefiles value cef value parse folder containing code example files to use for the x codesamples extension disabled by default parseinternal parse go files in internal packages disabled by default default false generatedtime generate timestamp at the top of docs go disabled by default default false parsedepth value dependency parse depth default 100 requiredbydefault set validation required for all fields by default default false instancename value this parameter can be used to name different swagger document instances it is optional overridesfile value file to read global type overrides from default swaggo parsegolist parse dependency via go list default true tags value t value a comma separated list of tags to filter the apis for which the documentation is generated special case if the tag is prefixed with the character then the apis with that tag will be excluded templatedelims value td value provide custom delimiters for go template generation the format is leftdelim rightdelim for example collectionformat value cf value set default collection format default csv state value initial state for the state machine default hoststate in root file state in other files parsefuncbody parse api info within body of functions in go files disabled by default default false help h show help default false swag fmt h name swag fmt format swag comments usage swag fmt command options arguments options dir value d value directories you want to parse comma separated and general info file must be in the first one default exclude value exclude directories and files when searching comma separated generalinfo value g value go file path in which swagger general api info is written default main go help h show help default false supported web frameworks gin echo buffalo net http gorilla mux go chi chi flamingo fiber atreugo hertz how to use it with gin find the example source code here finish the steps in getting started after using swag init to generate swagger 2 0 docs import the following packages import github com swaggo gin swagger gin swagger middleware import github com swaggo files swagger embed files add general api annotations in main go code title swagger example api version 1 0 description this is a sample server celler server termsofservice http swagger io terms contact name api support contact url http www swagger io support contact email support swagger io license name apache 2 0 license url http www apache org licenses license 2 0 html host localhost 8080 basepath api v1 securitydefinitions basic basicauth externaldocs description openapi externaldocs url https swagger io resources open api func main r gin default c controller newcontroller v1 r group api v1 accounts v1 group accounts accounts get id c showaccount accounts get c listaccounts accounts post c addaccount accounts delete id c deleteaccount accounts patch id c updateaccount accounts post id images c uploadaccountimage r get swagger any ginswagger wraphandler swaggerfiles handler r run 8080 additionally some general api info can be set dynamically the generated code package docs exports swaggerinfo variable which we can use to set the title description version host and base path programmatically example using gin package main import github com gin gonic gin github com swaggo files github com swaggo gin swagger docs docs is generated by swag cli you have to import it contact name api support contact url http www swagger io support contact email support swagger io license name apache 2 0 license url http www apache org licenses license 2 0 html func main programmatically set swagger info docs swaggerinfo title swagger example api docs swaggerinfo description this is a sample server petstore server docs swaggerinfo version 1 0 docs swaggerinfo host petstore swagger io docs swaggerinfo basepath v2 docs swaggerinfo schemes string http https r gin new use ginswagger middleware to serve the api docs r get swagger any ginswagger wraphandler swaggerfiles handler r run add api operation annotations in controller code package controller import fmt net http strconv github com gin gonic gin github com swaggo swag example celler httputil github com swaggo swag example celler model showaccount godoc summary show an account description get string by id tags accounts accept json produce json param id path int true account id success 200 object model account failure 400 object httputil httperror failure 404 object httputil httperror failure 500 object httputil httperror router accounts id get func c controller showaccount ctx gin context id ctx param id aid err strconv atoi id if err nil httputil newerror ctx http statusbadrequest err return account err model accountone aid if err nil httputil newerror ctx http statusnotfound err return ctx json http statusok account listaccounts godoc summary list accounts description get accounts tags accounts accept json produce json param q query string false name search by q format email success 200 array model account failure 400 object httputil httperror failure 404 object httputil httperror failure 500 object httputil httperror router accounts get func c controller listaccounts ctx gin context q ctx request url query get q accounts err model accountsall q if err nil httputil newerror ctx http statusnotfound err return ctx json http statusok accounts swag init run your app and browse to http localhost 8080 swagger index html you will see swagger 2 0 api documents as shown below the swag formatter the swag comments can be automatically formatted just like go fmt find the result of formatting here usage swag fmt exclude folder swag fmt d exclude internal when using swag fmt you need to ensure that you have a doc comment for the function to ensure correct formatting this is due to swag fmt indenting swag comments with tabs which is only allowed after a standard doc comment for example use listaccounts lists all existing accounts summary list accounts description get accounts tags accounts accept json produce json param q query string false name search by q format email success 200 array model account failure 400 object httputil httperror failure 404 object httputil httperror failure 500 object httputil httperror router accounts get func c controller listaccounts ctx gin context implementation status swagger 2 0 document basic structure api host and base path paths and operations describing parameters describing request body describing responses mime types authentication basic authentication api keys adding examples file upload enums grouping operations with tags swagger extensions declarative comments format general api info example celler main go annotation description example title required the title of the application title swagger example api version required provides the version of the application api version 1 0 description a short description of the application description this is a sample server celler server tag name name of a tag tag name this is the name of the tag tag description description of the tag tag description cool description tag docs url url of the external documentation of the tag tag docs url https example com tag docs description description of the external documentation of the tag tag docs description best example documentation termsofservice the terms of service for the api termsofservice http swagger io terms contact name the contact information for the exposed api contact name api support contact url the url pointing to the contact information must be in the format of a url contact url http www swagger io support contact email the email address of the contact person organization must be in the format of an email address contact email support swagger io license name required the license name used for the api license name apache 2 0 license url a url to the license used for the api must be in the format of a url license url http www apache org licenses license 2 0 html host the host name or ip serving the api host localhost 8080 basepath the base path on which the api is served basepath api v1 accept a list of mime types the apis can consume note that accept only affects operations with a request body such as post put and patch value must be as described under mime types accept json produce a list of mime types the apis can produce value must be as described under mime types produce json query collection format the default collection array param format in query enums csv multi pipes tsv ssv if not set csv is the default query collection format multi schemes the transfer protocol for the operation that separated by spaces schemes http https externaldocs description description of the external document externaldocs description openapi externaldocs url url of the external document externaldocs url https swagger io resources open api x name the extension key must be start by x and take only json value x example key key value using markdown descriptions when a short string in your documentation is insufficient or you need images code examples and things like that you may want to use markdown descriptions in order to use markdown descriptions use the following annotations annotation description example title required the title of the application title swagger example api version required provides the version of the application api version 1 0 description markdown a short description of the application parsed from the api md file this is an alternative to description description markdown no value needed this parses the description from api md tag name name of a tag tag name this is the name of the tag tag description markdown description of the tag this is an alternative to tag description the description will be read from a file named like tagname md tag description markdown tag x name the extension key must be start by x and take only string value x example key value api operation example celler controller annotation description description a verbose explanation of the operation behavior description markdown a short description of the application the description will be read from a file e g description markdown details will load details md id a unique string used to identify the operation must be unique among all api operations tags a list of tags to each api operation that separated by commas summary a short summary of what the operation does accept a list of mime types the apis can consume note that accept only affects operations with a request body such as post put and patch value must be as described under mime types produce a list of mime types the apis can produce value must be as described under mime types param parameters that separated by spaces param name param type data type is mandatory comment attribute optional security security to each api operation success success response that separated by spaces return code or default param type data type comment failure failure response that separated by spaces return code or default param type data type comment response as same as success and failure header header in response that separated by spaces return code param type data type comment router path definition that separated by spaces path httpmethod deprecatedrouter as same as router but deprecated x name the extension key must be start by x and take only json value x codesample optional markdown usage take file as parameter this will then search for a file named like the summary in the given folder deprecated mark endpoint as deprecated mime types swag accepts all mime types which are in the correct format that is match besides that swag also accepts aliases for some mime types as follows alias mime ...
|