Skip to content
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 #124

Merged
merged 7 commits into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cmd/gotosocial/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,38 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// Package classification awesome.
//
// Documentation of our awesome AaaaaaaaaaPI.
//
// Schemes: http
// BasePath: /
// Version: 1.0.0
// Host: some-url.com
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Security:
// - basic
//
// SecurityDefinitions:
// basic:
// type: basic
//
// swagger:meta

package main

import (
"os"

"github.com/sirupsen/logrus"

_ "github.com/superseriousbusiness/gotosocial/docs"
"github.com/urfave/cli/v2"
)

Expand All @@ -32,6 +57,7 @@ var Version string
// Commit is the git commit of GtS being used
var Commit string

//go:generate swagger generate spec
func main() {
var v string
if Commit == "" {
Expand Down
9 changes: 9 additions & 0 deletions docs/api/swagger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# API Documentation

GoToSocial uses [go-swagger](https://github.com/go-swagger/go-swagger) to generate a V2 [OpenAPI specification](https://swagger.io/specification/v2/) document from code annotations.

The resulting API documentation is rendered below, for quick reference.

If you'd like to do more with the spec, you can also view the [swagger.yaml](/api/swagger/swagger.yaml) directly, and then paste it into something like the [Swagger Editor](https://editor.swagger.io/) in order to autogenerate GoToSocial API clients in different languages, convert the doc to JSON or OpenAPI v3 specification, etc. See [here](https://swagger.io/tools/open-source/getting-started/) for more.

!!swagger swagger.yaml!!
Loading