summerfish

package module
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

SummerFish

A refreshing way of handling swagger docs in Golang. Automatic documentation has arrived.

Description

With SummerFish we bring to Go developers a way of having swagger documentation auto-generated with no annotations needed!

This package contains a golang implementation of Swagger 2.0 (aka OpenAPI 2.0): it knows how to serialize and deserialize swagger specifications.

Swagger is a simple yet powerful representation of your RESTful API.

Features

summerfish-swagger brings to the go community a way of generating swagger documentation without needing any annotations or changes on the your code. It is also integrated with the Swagger UI to help you serving as one endpoint.

Example

You can check our live server docs at https://plicca.com/armadillo/docs/

Check out the example package to test with a minimum code example.

Project status

summerfish-swagger is still very early in its life.

Future features

  • Support more routers (currently we only support gorrila mux)
  • Increase test coverage
  • Your suggestion here :)

Help us out

Like this project? Feel free to create an issue, develop a new feature and contribute in any way to this project

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveCommentSection

func RemoveCommentSection(line string) (string, bool)

Types

type Config

type Config struct {
	Schemes                []string
	SwaggerFilePath        string
	SwaggerFileRoute       string
	SwaggerFileHeaderRoute string
	SwaggerUIRoute         string
	BaseRoute              string
}

type InputParameter

type InputParameter struct {
	Type        string           `json:"type"`
	GoName      string           `json:"x-go-name"`
	Description string           `json:"description"`
	Name        string           `json:"name"`
	QueryType   string           `json:"in"`
	Schema      SchemaParameters `json:"schema"`
}

type Method

type Method map[string]Operation

type NameType

type NameType struct {
	Name     string
	Type     string
	IsArray  bool
	Children []NameType
}

type Operation

type Operation struct {
	Parameters []InputParameter  `json:"parameters"`
	ID         string            `json:"operationId"`
	Summary    string            `json:"summary"`
	Tags       []string          `json:"tags"`
	Responses  map[string]string `json:"responses"`
}

type PathsHolder

type PathsHolder map[string]Method

type RouteHolder

type RouteHolder struct {
	Path     []NameType
	Query    []NameType
	Body     NameType
	FormData []NameType
	Route    string
	Methods  []string
	Name     string
}

func GetInfoFromRouter

func GetInfoFromRouter(r *mux.Router) (holders []RouteHolder, err error)

type RouteParser

type RouteParser struct {
	Route        string
	RelativePath string
	FullPath     string
	LineNumber   int
	Methods      []string
}

type SchemaParameters

type SchemaParameters struct {
	Type       string                      `json:"type"`
	Items      *SchemaParameters           `json:"items,omitempty"`
	Properties map[string]SchemaParameters `json:"properties,omitempty"`
}

type SchemeHolder

type SchemeHolder struct {
	Schemes        []string    `json:"schemes"`
	Host           string      `json:"host"`
	BasePath       string      `json:"basePath"`
	Paths          PathsHolder `json:"paths"`
	SwaggerVersion string      `json:"swagger"`
}

func (*SchemeHolder) GenerateSwaggerFile

func (s *SchemeHolder) GenerateSwaggerFile(routes []RouteHolder, filePath string) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL