discovery

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenApiV2Source = "OpenApi2"
	OpenApiV3Source = "OpenApi3"
)
View Source
const (
	Implicit          = "OAuth2Implicit"
	AuthorizationCode = "OAuth2AuthCode"
	Password          = "OAuth2Password"
	ClientCredentials = "OAuth2ClientCredentials"

	BasicSecSchemaType  = "http"
	ApiKeySecSchemaType = "apiKey"
	OAuth2SecSchemaType = "oauth2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Description string
	Required    bool
	Content     []Content
}

Body for a http request

type Content

type Content struct {
	ContentType string
	Schema      Schema
}

Content content in a request example: ContentType could for example be 'application/json And Schema holds information about the content like its format (keys and types) and if it's nullable

type Endpoint

type Endpoint struct {
	Path        string
	Method      string // POST, GET, etc.
	Body        Body
	Parameters  []Parameter
	Consumes    string
	Produces    string
	Responses   []Response
	Summary     string
	Description string
}

Endpoint information about an endpoint inside an API

type OAuthFlow

type OAuthFlow struct {
	GrantType        string
	AuthorizationURL string
	TokenURL         string
	RefreshURL       string
	Scopes           map[string]string
}

OAuthFlow configuration for a OAuth flow https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowsObject

type Parameter

type Parameter struct {
	Name        string
	In          string // body, header, etc.
	Required    bool
	Description string
	ParamType   string
	Schema      Schema
}

Parameter a parameter inside an endpoint

type Response

type Response struct {
	Code        int
	Description string
	Content     []Content
}

Response a response for a request to an endpoint

type Schema

type Schema struct {
	Key        string
	Type       string
	Format     string
	Nullable   bool
	AllowEmpty bool
	Example    any
	Properties []Schema
}

Schema holds information about an object like a json object, xml object, html document, etc.

type SecuritySchema

type SecuritySchema struct {
	Key string

	Type             string
	Description      string
	Name             string
	In               string
	BearerFormat     string
	OpenIdConnectUrl string
	Flows            []OAuthFlow
}

SecuritySchema defines a security scheme https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object

type WebApiDescription

type WebApiDescription struct {
	// DiscoverySource The source of the doc (OpenAPIv2, OpenAPIv3, etc.)
	DiscoverySource string
	// DiscoveryDoc literal URL of the discovery doc
	DiscoveryDoc url.URL
	// Version API version
	Version         string
	Title           string
	Description     string
	Endpoints       []Endpoint
	SecuritySchemes []SecuritySchema
}

WebApiDescription description of a web API holds information about: - endpoints (requests, responses, parameters, etc.) - global information (URL, version, description, title, etc.) - how to authenticate with the API (security information)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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