apispec

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProtoFiles added in v0.0.15

func GetProtoFiles() (files map[string]string, err error)

Types

type APIConverage

type APIConverage interface {
	HaveAPI(path, method string) (exist bool)
	APICount() (count int)
}

func NewFakeAPISpec

func NewFakeAPISpec(apis [][]string) APIConverage

NewFakeAPISpec creates a new instance of fakeAPISpec

type Parameter added in v0.0.16

type Parameter struct {
	Name string `json:"name"`
	// In represents the parameter type, supported values: query, path
	In       string `json:"in"`
	Required bool   `json:"required"`
	Schema   Schema `json:"schema"`
}

type Schema added in v0.0.16

type Schema struct {
	Type   string `json:"type"`
	Format string `json:"format"`
}

type Swagger

type Swagger struct {
	Swagger string `json:"swagger"`
	// Paths includes all the API requests.
	// The keys is the HTTP request method which as lower-case, for example: get, post.
	Paths map[string]map[string]SwaggerAPI `json:"paths"`
	Info  SwaggerInfo                      `json:"info"`
}

func ParseStreamToSwagger

func ParseStreamToSwagger(stream io.Reader) (swagger *Swagger, err error)

func ParseToSwagger

func ParseToSwagger(data []byte) (swagger *Swagger, err error)

func ParseURLToSwagger

func ParseURLToSwagger(swaggerURL string) (swagger *Swagger, err error)

func (*Swagger) APICount

func (s *Swagger) APICount() (count int)

APICount return the count of APIs

func (*Swagger) HaveAPI

func (s *Swagger) HaveAPI(path, method string) (exist bool)

HaveAPI check if the swagger has the API. If the path is /api/v1/names/linuxsuren, then will match /api/v1/names/{name}

type SwaggerAPI

type SwaggerAPI struct {
	OperationId string      `json:"operationId"`
	Parameters  []Parameter `json:"parameters"`
	Summary     string      `json:"summary"`
}

type SwaggerInfo

type SwaggerInfo struct {
	Description string `json:"description"`
	Title       string `json:"title"`
	Version     string `json:"version"`
}

Jump to

Keyboard shortcuts

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