Skip to content

Commit 0cc5e22

Browse files
authored
docs.sh: fix narrow docs checks spectrum (#877)
1 parent 4e7d031 commit 0cc5e22

10 files changed

+2474
-170
lines changed

.github/docs/openapi2.txt

Lines changed: 183 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,185 @@
1-
type Header struct{ ... }
2-
type Operation struct{ ... }
3-
type Parameter struct{ ... }
1+
package openapi2 // import "github.com/getkin/kin-openapi/openapi2"
2+
3+
Package openapi2 parses and writes OpenAPIv2 specification documents.
4+
5+
Does not cover all elements of OpenAPIv2. When OpenAPI version 3 is
6+
backwards-compatible with version 2, version 3 elements have been used.
7+
8+
See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
9+
10+
TYPES
11+
12+
type Header struct {
13+
Parameter
14+
}
15+
16+
func (header Header) MarshalJSON() ([]byte, error)
17+
MarshalJSON returns the JSON encoding of Header.
18+
19+
func (header *Header) UnmarshalJSON(data []byte) error
20+
UnmarshalJSON sets Header to a copy of data.
21+
22+
type Operation struct {
23+
Extensions map[string]interface{} `json:"-" yaml:"-"`
24+
25+
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
26+
Description string `json:"description,omitempty" yaml:"description,omitempty"`
27+
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
28+
ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
29+
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
30+
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
31+
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
32+
Responses map[string]*Response `json:"responses" yaml:"responses"`
33+
Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty"`
34+
Produces []string `json:"produces,omitempty" yaml:"produces,omitempty"`
35+
Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty"`
36+
Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
37+
}
38+
39+
func (operation Operation) MarshalJSON() ([]byte, error)
40+
MarshalJSON returns the JSON encoding of Operation.
41+
42+
func (operation *Operation) UnmarshalJSON(data []byte) error
43+
UnmarshalJSON sets Operation to a copy of data.
44+
45+
type Parameter struct {
46+
Extensions map[string]interface{} `json:"-" yaml:"-"`
47+
48+
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
49+
50+
In string `json:"in,omitempty" yaml:"in,omitempty"`
51+
Name string `json:"name,omitempty" yaml:"name,omitempty"`
52+
Description string `json:"description,omitempty" yaml:"description,omitempty"`
53+
CollectionFormat string `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
54+
Type string `json:"type,omitempty" yaml:"type,omitempty"`
55+
Format string `json:"format,omitempty" yaml:"format,omitempty"`
56+
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
57+
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
58+
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
59+
UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
60+
ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
61+
ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
62+
Schema *openapi3.SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
63+
Items *openapi3.SchemaRef `json:"items,omitempty" yaml:"items,omitempty"`
64+
Enum []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"`
65+
MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
66+
Minimum *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
67+
Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
68+
MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
69+
MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
70+
MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
71+
MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"`
72+
Default interface{} `json:"default,omitempty" yaml:"default,omitempty"`
73+
}
74+
75+
func (parameter Parameter) MarshalJSON() ([]byte, error)
76+
MarshalJSON returns the JSON encoding of Parameter.
77+
78+
func (parameter *Parameter) UnmarshalJSON(data []byte) error
79+
UnmarshalJSON sets Parameter to a copy of data.
80+
481
type Parameters []*Parameter
5-
type PathItem struct{ ... }
6-
type Response struct{ ... }
82+
83+
func (ps Parameters) Len() int
84+
85+
func (ps Parameters) Less(i, j int) bool
86+
87+
func (ps Parameters) Swap(i, j int)
88+
89+
type PathItem struct {
90+
Extensions map[string]interface{} `json:"-" yaml:"-"`
91+
92+
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
93+
94+
Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
95+
Get *Operation `json:"get,omitempty" yaml:"get,omitempty"`
96+
Head *Operation `json:"head,omitempty" yaml:"head,omitempty"`
97+
Options *Operation `json:"options,omitempty" yaml:"options,omitempty"`
98+
Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
99+
Post *Operation `json:"post,omitempty" yaml:"post,omitempty"`
100+
Put *Operation `json:"put,omitempty" yaml:"put,omitempty"`
101+
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
102+
}
103+
104+
func (pathItem *PathItem) GetOperation(method string) *Operation
105+
106+
func (pathItem PathItem) MarshalJSON() ([]byte, error)
107+
MarshalJSON returns the JSON encoding of PathItem.
108+
109+
func (pathItem *PathItem) Operations() map[string]*Operation
110+
111+
func (pathItem *PathItem) SetOperation(method string, operation *Operation)
112+
113+
func (pathItem *PathItem) UnmarshalJSON(data []byte) error
114+
UnmarshalJSON sets PathItem to a copy of data.
115+
116+
type Response struct {
117+
Extensions map[string]interface{} `json:"-" yaml:"-"`
118+
119+
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
120+
121+
Description string `json:"description,omitempty" yaml:"description,omitempty"`
122+
Schema *openapi3.SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
123+
Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
124+
Examples map[string]interface{} `json:"examples,omitempty" yaml:"examples,omitempty"`
125+
}
126+
127+
func (response Response) MarshalJSON() ([]byte, error)
128+
MarshalJSON returns the JSON encoding of Response.
129+
130+
func (response *Response) UnmarshalJSON(data []byte) error
131+
UnmarshalJSON sets Response to a copy of data.
132+
7133
type SecurityRequirements []map[string][]string
8-
type SecurityScheme struct{ ... }
9-
type T struct{ ... }
134+
135+
type SecurityScheme struct {
136+
Extensions map[string]interface{} `json:"-" yaml:"-"`
137+
138+
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
139+
140+
Description string `json:"description,omitempty" yaml:"description,omitempty"`
141+
Type string `json:"type,omitempty" yaml:"type,omitempty"`
142+
In string `json:"in,omitempty" yaml:"in,omitempty"`
143+
Name string `json:"name,omitempty" yaml:"name,omitempty"`
144+
Flow string `json:"flow,omitempty" yaml:"flow,omitempty"`
145+
AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
146+
TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
147+
Scopes map[string]string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
148+
Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
149+
}
150+
151+
func (securityScheme SecurityScheme) MarshalJSON() ([]byte, error)
152+
MarshalJSON returns the JSON encoding of SecurityScheme.
153+
154+
func (securityScheme *SecurityScheme) UnmarshalJSON(data []byte) error
155+
UnmarshalJSON sets SecurityScheme to a copy of data.
156+
157+
type T struct {
158+
Extensions map[string]interface{} `json:"-" yaml:"-"`
159+
160+
Swagger string `json:"swagger" yaml:"swagger"` // required
161+
Info openapi3.Info `json:"info" yaml:"info"` // required
162+
ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
163+
Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty"`
164+
Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty"`
165+
Produces []string `json:"produces,omitempty" yaml:"produces,omitempty"`
166+
Host string `json:"host,omitempty" yaml:"host,omitempty"`
167+
BasePath string `json:"basePath,omitempty" yaml:"basePath,omitempty"`
168+
Paths map[string]*PathItem `json:"paths,omitempty" yaml:"paths,omitempty"`
169+
Definitions map[string]*openapi3.SchemaRef `json:"definitions,omitempty" yaml:"definitions,omitempty"`
170+
Parameters map[string]*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
171+
Responses map[string]*Response `json:"responses,omitempty" yaml:"responses,omitempty"`
172+
SecurityDefinitions map[string]*SecurityScheme `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"`
173+
Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
174+
Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
175+
}
176+
T is the root of an OpenAPI v2 document
177+
178+
func (doc *T) AddOperation(path string, method string, operation *Operation)
179+
180+
func (doc T) MarshalJSON() ([]byte, error)
181+
MarshalJSON returns the JSON encoding of T.
182+
183+
func (doc *T) UnmarshalJSON(data []byte) error
184+
UnmarshalJSON sets T to a copy of data.
185+

.github/docs/openapi2conv.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
package openapi2conv // import "github.com/getkin/kin-openapi/openapi2conv"
2+
3+
Package openapi2conv converts an OpenAPI v2 specification document to v3.
4+
5+
FUNCTIONS
6+
17
func FromV3(doc3 *openapi3.T) (*openapi2.T, error)
8+
FromV3 converts an OpenAPIv3 spec to an OpenAPIv2 spec
9+
210
func FromV3Headers(defs openapi3.Headers, components *openapi3.Components) (map[string]*openapi2.Header, error)
311
func FromV3Operation(doc3 *openapi3.T, operation *openapi3.Operation) (*openapi2.Operation, error)
412
func FromV3Parameter(ref *openapi3.ParameterRef, components *openapi3.Components) (*openapi2.Parameter, error)
513
func FromV3PathItem(doc3 *openapi3.T, pathItem *openapi3.PathItem) (*openapi2.PathItem, error)
614
func FromV3Ref(ref string) string
7-
func FromV3RequestBody(name string, requestBodyRef *openapi3.RequestBodyRef, ...) (*openapi2.Parameter, error)
15+
func FromV3RequestBody(name string, requestBodyRef *openapi3.RequestBodyRef, mediaType *openapi3.MediaType, components *openapi3.Components) (*openapi2.Parameter, error)
816
func FromV3RequestBodyFormData(mediaType *openapi3.MediaType) openapi2.Parameters
917
func FromV3Response(ref *openapi3.ResponseRef, components *openapi3.Components) (*openapi2.Response, error)
1018
func FromV3Responses(responses map[string]*openapi3.ResponseRef, components *openapi3.Components) (map[string]*openapi2.Response, error)
@@ -13,10 +21,12 @@ func FromV3Schemas(schemas map[string]*openapi3.SchemaRef, components *openapi3.
1321
func FromV3SecurityRequirements(requirements openapi3.SecurityRequirements) openapi2.SecurityRequirements
1422
func FromV3SecurityScheme(doc3 *openapi3.T, ref *openapi3.SecuritySchemeRef) (*openapi2.SecurityScheme, error)
1523
func ToV3(doc2 *openapi2.T) (*openapi3.T, error)
24+
ToV3 converts an OpenAPIv2 spec to an OpenAPIv3 spec
25+
1626
func ToV3Headers(defs map[string]*openapi2.Header) openapi3.Headers
17-
func ToV3Operation(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, ...) (*openapi3.Operation, error)
18-
func ToV3Parameter(components *openapi3.Components, parameter *openapi2.Parameter, ...) (*openapi3.ParameterRef, *openapi3.RequestBodyRef, ...)
19-
func ToV3PathItem(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, ...) (*openapi3.PathItem, error)
27+
func ToV3Operation(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, operation *openapi2.Operation, consumes []string) (*openapi3.Operation, error)
28+
func ToV3Parameter(components *openapi3.Components, parameter *openapi2.Parameter, consumes []string) (*openapi3.ParameterRef, *openapi3.RequestBodyRef, map[string]*openapi3.SchemaRef, error)
29+
func ToV3PathItem(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, consumes []string) (*openapi3.PathItem, error)
2030
func ToV3Ref(ref string) string
2131
func ToV3Response(response *openapi2.Response, produces []string) (*openapi3.ResponseRef, error)
2232
func ToV3SchemaRef(schema *openapi3.SchemaRef) *openapi3.SchemaRef

0 commit comments

Comments
 (0)