openapi

package
v3.10.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package openapi contains data structures for Swagger v2.0.

We use these data structures to compare the API specification we have here with the one of the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Title   string `json:"title"`
	Version string `json:"version"`
}

API contains info about the API

type Body

type Body struct {
	Description interface{} `json:"description,omitempty"`
	Schema      *Schema     `json:"schema"`
}

Body describes a response body

type Parameter

type Parameter struct {
	In       string  `json:"in"`
	Name     string  `json:"name"`
	Required bool    `json:"required,omitempty"`
	Schema   *Schema `json:"schema,omitempty"`
	Type     string  `json:"type,omitempty"`
}

Parameter describes an input parameter, which could be in the URL path, in the query string, or in the request body

type Path

type Path struct {
	Get  *RoundTrip `json:"get,omitempty"`
	Post *RoundTrip `json:"post,omitempty"`
}

Path describes a path served by the API

type Responses

type Responses struct {
	Successful Body `json:"200"`
}

Responses describes the possible responses

type RoundTrip

type RoundTrip struct {
	Consumes   []string     `json:"consumes,omitempty"`
	Produces   []string     `json:"produces,omitempty"`
	Parameters []*Parameter `json:"parameters,omitempty"`
	Responses  *Responses   `json:"responses,omitempty"`
}

RoundTrip describes an HTTP round trip with a given method and path

type Schema

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

Schema is the schema of a specific parameter or or the schema used by the response body

type Swagger

type Swagger struct {
	Swagger  string           `json:"swagger"`
	Info     API              `json:"info"`
	Host     string           `json:"host"`
	BasePath string           `json:"basePath"`
	Schemes  []string         `json:"schemes"`
	Paths    map[string]*Path `json:"paths"`
}

Swagger is the toplevel structure

Jump to

Keyboard shortcuts

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