Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
cc09e84
feat: support nil uuid (#778)
zekth Mar 24, 2023
d12c756
openapi3filter: introduce `func ConvertErrors(err error) error` (#783)
qifanchriswu Apr 18, 2023
994d4f0
openapi3filter: drop useless DefaultOptions (#785)
fenollp Apr 18, 2023
1b54b4d
openapi3gen: fix panic when embedded type is not a struct (#792)
nrwiersma May 13, 2023
b8c06e7
openapi3filter: fix oneOF validation in query params (#790)
ju-zp May 18, 2023
fd52f34
fix crash on load (#795)
May 30, 2023
5a6f97e
openapi3: fix #796 infinite loop during document validation (#797)
radwaretaltr Jun 7, 2023
9128b1e
openapi3,routers: simplify code (#800)
alexandear Jun 16, 2023
543ec7e
lint: fix typos in comments, tests and README (#799)
alexandear Jun 16, 2023
ba75112
openapi3: fix tests (#801)
alexandear Jun 17, 2023
356060b
Add projectsveltos addon-controller (#802)
gianlucam76 Jun 18, 2023
0045da1
openapi3: fix links to JSONPointable iface (#803)
fenollp Jun 18, 2023
0683bc5
openapi3: late Spring cleanup (#804)
fenollp Jun 18, 2023
41d2575
openapi3: split info.go three ways (#805)
fenollp Jun 18, 2023
5eeca32
openapi3filter: simplify validation test (#806)
alexandear Jun 19, 2023
0d0b0ae
openapi3,openapi3filter: refactor bytes.Buffer creation (#807)
alexandear Jun 19, 2023
48ce1ee
openapi3: spell "marshal" with one "l" for consistency (#808)
alexandear Jun 20, 2023
f333d82
openapi3: refactor tests: use BoolPtr, require.Same (#809)
alexandear Jun 20, 2023
ba08e37
openapi3,openapi3filter: fix typos in comments, tests (#810)
alexandear Jun 20, 2023
98141fa
openapi3: fix #775 race on schema pattern regex compilation (#811)
fenollp Jun 21, 2023
eb2a1b3
openapi3: move helpers to their own dedicated file (#813)
fenollp Jun 22, 2023
4ba7452
cmd/validate: support setting openapi3.CircularReferenceCounter (#815)
fenollp Jun 23, 2023
b81a83e
add LoadFromStdin (#820)
const-tmp Jul 16, 2023
409c01f
Fix Enum Query Parameters (#822)
mgross-ebner Aug 8, 2023
3e384a2
Use os.ReadFile instead of ioutil.ReadFile (#691)
fenollp Aug 8, 2023
2da5472
sponsor: Speakeasy Rebrand (#826)
fenollp Aug 15, 2023
05ec773
openapi3: support patterned fields in Responses (#819) (#827)
mgirouard Aug 18, 2023
e27de61
sponsor: toggle logo in dark/light modes (#829)
fenollp Aug 23, 2023
91659ae
openapi3: fix format error when Header marshal to YAML (#823)
caixw Aug 26, 2023
8c08c70
openapi3: fix func doc after #823 (#830)
fenollp Aug 26, 2023
14c8565
openapi3: fix ref internalization (#832)
radwaretaltr Aug 30, 2023
4f6515e
fix/ update version of go to 1.20 (#837)
lyndonhebditch-aviva Sep 5, 2023
b58fbe3
openapi3: add missing document parameter validations (#835)
radwaretaltr Sep 5, 2023
d14f7e0
Exclude gopkg.in/yaml.v3 v3.0.0 (#838)
natehart Sep 7, 2023
fbee2c5
Replace deprecated io/ioutil with io (#840)
alexandear Sep 16, 2023
2d85e01
fix compile errors in README example code (#842)
Jumpaku Sep 16, 2023
62849cf
openapi3: add length of circular reference to error message (#839)
jamietanna Sep 16, 2023
93c2756
openapi2conv: fix that removes an extra `required` array from `formDa…
liankui Oct 18, 2023
fa7ca86
openapi3: fix schema validation for `anyOf`, `allOf`, `oneOf` operati…
AmadeusK525 Oct 20, 2023
e8667b6
reproduce incorrect allOf + nullable behaviour (#253)
fenollp Oct 20, 2023
c446426
reproduce issue #423 (#432)
fenollp Oct 20, 2023
bfab8b0
openapi2conv: expose loader and location to ToV3 (#851)
AriehSchneier Oct 31, 2023
a53cd59
openAPI3 template T class add server helper function (#852)
spdrcd Nov 7, 2023
49395dd
openapi3: handle tangible *nil in Schema.IsEmpty impl (#858)
fenollp Nov 25, 2023
40b56cb
openapi3: no longer error when drilling into a silenced yaml tag (#859)
fenollp Nov 25, 2023
14fc067
openapi3: shave some tests (#862)
fenollp Nov 25, 2023
6986148
openapi3: refacto drill bit (#865)
fenollp Nov 25, 2023
a610111
openapi3: unify Loader.resolve*Ref impls (#863)
fenollp Nov 26, 2023
961d6f5
openapi3: refacto path resolving, remove a couple error cases (#864)
fenollp Nov 26, 2023
a643c4c
openapi3: fast path drilling into UFO-type refs (#866)
fenollp Nov 26, 2023
6c9b4a8
cmd/validate: read v2 documents that dont mention swagger as well (#868)
fenollp Nov 26, 2023
a914871
openapi3: save some allocs when checking extras in refs (#869)
fenollp Nov 26, 2023
4305869
openapi3: fix validating extra siblings in remote refs (#872)
fenollp Nov 26, 2023
bd3ac0e
openapi3: reclaims Extensions unused mem post-unmarshal (#871)
fenollp Nov 26, 2023
582e6d0
openapi3: handle refs missing fragment (#511)
fenollp Nov 26, 2023
e7a726a
openapi3: support \uC4FE codepoint syntax in Schema.Pattern (#873)
fenollp Nov 26, 2023
fe1c5f5
close #594: yaml "control characters are not allowed" no longer repro…
fenollp Nov 26, 2023
377bb40
openapi{2,3}: simplify unmarshal errors (#870)
fenollp Nov 26, 2023
663b0dd
openapi3: refacto ref-resolving end conditions (#874)
fenollp Nov 26, 2023
c1681a9
openapi3: rename type of Components.Responses to ResponseBodies (from…
fenollp Nov 27, 2023
4e7d031
openapi3: correct implementations of JSONLookup (#876)
fenollp Nov 27, 2023
0cc5e22
docs.sh: fix narrow docs checks spectrum (#877)
fenollp Nov 28, 2023
f6d1b8c
fix after #870: make sure Bis does not surface up (#878)
fenollp Nov 28, 2023
6740cd2
openapi3: add support for extensions on the few types left (#763)
fenollp Nov 28, 2023
0bd3056
Update README.md (#881)
syordanov94 Dec 1, 2023
36afc12
openapi3: optimize Unmarshal for maplike structs (#882)
fenollp Dec 2, 2023
c00d180
feat(openapi3filter): add ExludeRequestQuery (#886)
zekth Dec 8, 2023
62bf0f7
feat: support default value binding with allOfSchema (#885)
podhmo Dec 9, 2023
c3d9748
openapi3: fix abort logic of validation for schemas with anyOf, allOf…
AmadeusK525 Jan 22, 2024
9d820c9
cmd/validate: re-enable go run ...@latest now that unsafe dep sums ar…
fenollp Jan 22, 2024
e0f8dbd
ci: make sure go-run'ing binaries works (#894)
fenollp Jan 22, 2024
7d030b2
Make the JSON body decode public (#896)
cdent Jan 23, 2024
529285c
add Delete operation to maplike structs (#899)
tcdsv Jan 29, 2024
55bc380
openapi3filter: fix `x-www-form-urlencoded` decoder for oneOf, anyOf,…
imtaketa Feb 2, 2024
439335c
openapi3filter: add `Unwrap()` method to SecurityRequirementsError (#…
nickajacks1 Feb 11, 2024
3bbab36
openapi3: introduce LoadFromIoReader (#906)
Feb 11, 2024
05ccac2
openapi3filter: support deepObject with nested objects and array para…
danicc097 Feb 20, 2024
672dc32
openapi2,3: support array of types in `type` field (#912)
brandonbloom Feb 25, 2024
7aa9f7e
openapi3: fix regex replacing `\u` literals (#918)
thiagownt Mar 5, 2024
05453ef
openapi3filter: fix array of primitives query parameter types (#921)
danicc097 Mar 9, 2024
7f46bdf
openapi3: Implement YAML Marshaler interface for AdditionalProperties…
praneetloke Mar 11, 2024
78bb273
openapi3filter: deepObject array of objects and array of arrays suppo…
danicc097 Mar 22, 2024
5aee5fc
openapi3gen: allow overriding how a Schema is generated (#920)
taufik-rama Apr 6, 2024
134eaa0
openapi3gen: rename example to show up in docs (#932)
fenollp Apr 6, 2024
5a2e949
openapi3: implement YAML Marshaller interface for paths and responses…
nobbynobbs Apr 6, 2024
5a6afbe
openapi3filter: some syntax tweaks (#933)
fenollp Apr 6, 2024
b6f165a
openapi3: tests for #931 (#887)
fenollp Apr 6, 2024
8d57cda
openapi3filter: guard BodyEncoder registration behind a RW lock (#934)
fenollp Apr 6, 2024
9dbb4c3
openapi3gen: add CreateComponentSchemas option to export object schem…
fenollp Apr 6, 2024
77651ce
Revert "openapi3gen: add CreateComponentSchemas option to export obje…
EnriqueL8 Apr 9, 2024
717aee5
openapi3gen: add CreateComponentSchemas option to export object schem…
EnriqueL8 Apr 9, 2024
fb0a24e
Merge pull request #937 from EnriqueL8/revert-935-add_components_sche…
fenollp Apr 9, 2024
62d1ef1
openapi3: keep oneOf context in markSchemaErrorKey (#940) (#941)
jordan-wu-97 Apr 16, 2024
f66e2a1
docs: add github.com/a-h/rest to projects list (#942)
a-h Apr 16, 2024
b9f83d9
openapi4filter: improve CSV resp decoder performance (#948)
mpoqq May 11, 2024
2ab0c0e
openapi3filter: ensure key matches param name before decoding in `(*u…
MateusFrFreitas May 11, 2024
03281ec
openapi3: ensure YAML marshalling matches JSON's (#943)
damien-talos Jun 2, 2024
2cf1262
openapi{2,3}: surface both json/yaml unmarshal errors (#950)
timothympace Jun 2, 2024
f170f8c
openapi3(tests): use testify's `YAMLEq` function (#954)
percivalalb Jun 2, 2024
45b4399
openapi3filter: add context to Validator Middleware's ErrFunc and Log…
crissi98 Jun 2, 2024
518b18d
openapi3: move ref codegen to Go (#956)
percivalalb Jun 2, 2024
8d5ee0b
changelog: note API breakage from #953 (#957)
fenollp Jun 2, 2024
43846d5
openapi3: internalize refs for path parameters (#960)
selaux Jun 10, 2024
b18a27a
ci: drop CodeQL (#962)
fenollp Jun 10, 2024
78b7c31
openapi3: document v0.124.0 breaking API changes (#964)
percivalalb Jun 16, 2024
061c378
openapi3: introduce `ReferencesComponentInRootDocument(doc *T, ref co…
percivalalb Jun 16, 2024
c112aae
Update Go module dependencies (#965)
percivalalb Jun 16, 2024
3aa9b4e
Move paragraph back to its correct section (#967)
percivalalb Jun 17, 2024
7ec3129
Replace interface{} with any (#966)
percivalalb Jun 18, 2024
57624b3
openapi3: allow Extensions next to $ref in SchemaRef (#901)
paulmach Jun 24, 2024
fe47dca
openapi3: implement circular reference backtracking (#970)
AnatolyRugalev Jun 26, 2024
42a2d80
openapi3: improve ipv6 validation (#971)
AnatolyRugalev Jun 27, 2024
a27c9e7
openapi3: resolve recursive file references (#974)
AnatolyRugalev Jul 1, 2024
0ed9f5d
openapi3: improve internalization ref naming to avoid collisions (#955)
percivalalb Jul 3, 2024
4b53bf6
openapi3: add a test for additionalProperties: false validation (#975)
AnatolyRugalev Jul 4, 2024
4144c56
openapi3: add support for number and integer format validators (#976)
AnatolyRugalev Jul 5, 2024
2692f43
openapi3: allow YAML-marshaling invalid specs (#977)
fenollp Jul 5, 2024
3e230a6
Include local reference parts in refPath saved (#978)
percivalalb Jul 7, 2024
a7bc0ff
fix: update type: file to type: string and format: binary (#980)
reversearrow Jul 10, 2024
8c15898
test: add a test for #499 (#982)
AnatolyRugalev Jul 10, 2024
1a819a1
test: add a test for #961 (#981)
AnatolyRugalev Jul 10, 2024
25ce765
fixes #968 - openapi3gen: generate "nullable: true" for pointers (#987)
endertunc Jul 20, 2024
1a2712f
openapi3filter: Remove inconsistency for arrays in queries (#990)
TheSadlig Jul 23, 2024
cd0a337
openapi3filter: remove double call (#993)
AriehSchneier Jul 27, 2024
cf9684e
openapi3filter: Fix default arrays application for query parameters (…
TheSadlig Jul 27, 2024
f7ebd9c
routers: downgrade gorilla/mux to v1.8.0 for #988 (#996)
fenollp Jul 27, 2024
b5bcd71
openapi3: export `ComponentRef` for usage in `RefNameResolver` (#998)
fenollp Jul 30, 2024
d722646
Add note on gorillamux (#999)
fenollp Jul 30, 2024
af90e9a
openapi3filter: Fix default value for array in for query param (#1000)
Tommy-42 Aug 2, 2024
b771380
Add github.com/pb33f/libopenapi (#1004)
Jille Aug 22, 2024
2a0cad9
Introduce an option to override the regex implementation (#1006)
alexbakker Aug 26, 2024
c606b55
make form required field order deterministic (#1008)
jlsherrill Aug 30, 2024
1eeb41c
openapi2: fix un/marshalling discriminator field (#1011)
reversearrow Oct 1, 2024
93a629b
README: add Fuego to dependents (#1017)
EwenQuim Oct 8, 2024
75728b3
openapi3: skip a test in CI to avoid 403s from some remote server (#1…
fenollp Oct 14, 2024
56505dc
openapi3: introduce StringMap type to enable unmarshalling of maps wi…
reuvenharrison Oct 16, 2024
c333b34
openapi3: reference originating locations in YAML specs - step 1 (#1007)
reuvenharrison Oct 21, 2024
7145b2c
openapi3: reference originating locations in YAML specs - step 2 (#1024)
reuvenharrison Oct 23, 2024
4d76e26
openapi3: process discriminator mapping values as refs (#1022)
jgresty Oct 24, 2024
c41a068
openapi3filter: register decoder for other JSON content types (#1026)
oliverli Nov 3, 2024
344c7d3
Revert "openapi3: process discriminator mapping values as refs" (#1029)
fenollp Nov 8, 2024
4fda0cc
openapi3: fail to load spec because of schema names in mapping (#1027)
reuvenharrison Nov 8, 2024
e230c13
openapi2conv: convert schemaRef for additional props (#1030)
jayanth-tatina-groww Nov 13, 2024
02a0d6f
openapi3: simplify by replacing math.Min with min (#1032)
alexandear Nov 26, 2024
be48da5
openapi3: fix deprecation comments (#1034)
alexandear Nov 26, 2024
793b28d
test: fix expected-actual parameters in require.Equal (#1035)
alexandear Nov 26, 2024
d819171
use forked yaml modules without "replace" (#1038)
reuvenharrison Dec 11, 2024
b82c647
openapi3: update date schema formats to not match months or days of '…
RulerOfTheQueendom Dec 11, 2024
20441ea
openapi3,openapi3filter: replace interface{} with any (#1040)
alexandear Dec 11, 2024
325cecc
openapi3filter: simplify ValidateRequest implementation (#1041)
alexandear Dec 11, 2024
f476f7b
openapi3filter: validation of `x-www-form-urlencoded` with arbitrary …
mikhalytch Dec 24, 2024
cea0a13
openapi2conv: convert references in nested additionalProperties schem…
travisnewhouse Dec 24, 2024
72fb819
feat(openapi3gen): Customize json.RawMessage (#1050)
kyleconroy Feb 3, 2025
050a930
openapi3gen: Fix issue with separate component generated for time.Tim…
d1vbyz3r0 Feb 10, 2025
e3d68dc
Remove redundant ExcludeResponseBody check in ValidateResponse (#1056)
tatsumack Mar 10, 2025
2d3e67a
use __origin__ to minimize collisions (#1057)
reuvenharrison Mar 10, 2025
a34baf0
openapi3: delete origin keys only when IncludeOrigin=true (#1055)
reuvenharrison Mar 12, 2025
6da871e
openapi3filter: apply default values of an array in a query param wit…
nhochstr Mar 12, 2025
67f0b23
openapi3filter: de-register ZipFileBodyDecoder and make a few decoder…
fenollp Mar 19, 2025
3cf8f7d
style: Use fmt.Sprint without formating (#1061)
gaiaz-iusipov Mar 29, 2025
75e2cc5
openapi3filter: don't consume request body in `AuthenticatorFunc` (#1…
Apr 7, 2025
72b5d51
openapi2conv: fix for refs on items within additional properties (#1067)
roberth1988 Apr 29, 2025
bf26c56
fix: resolve Snyk security warning with path traversal (#1066)
seborama May 1, 2025
d4bdebd
openapi3: replace bigfloat with decimal128 to fix rounding errors dur…
Revolyssup May 9, 2025
90fb641
openapi2conv: Set externalDocs for Operations (#1070)
hwustrack May 19, 2025
783206b
openapi3: fix ineffectual caching of compiled regexps (#1076)
philpearl Jun 10, 2025
2de45f7
openapi3: use Ptr instead of BoolPtr,Float64Ptr,Int64Ptr,Uint64Ptr (#…
alexandear Jun 16, 2025
d72d75b
openapi3: resolve refs in parameter examples (#1086)
reuvenharrison Jul 30, 2025
4358c4a
feat: add support for RFC 7396 application/merge-patch+json (#1084)
byted Aug 4, 2025
6acf92b
openapi3filter: use FileBodyDecoder if the format is specified as bin…
dbarrosop Aug 7, 2025
e00a340
openapi3: preserve all validation errors for allOf (#1087)
alexbakker Aug 10, 2025
a33c5f8
openapi3filter: support primitive parsing for individual text like pa…
nmeheus Aug 21, 2025
59b018c
Some coding style fixes and cleaning up (#1093)
fenollp Aug 21, 2025
2baea3d
openapi2conv: preserve x-fields when converting from v2 to v3 (#1092)
saltbo Aug 25, 2025
571d846
[TT-16113] Updated kin-openapi to version 0.133.0
lghiur Dec 3, 2025
c8f3175
remove claude
lghiur Dec 3, 2025
b5c1361
fix
lghiur Dec 3, 2025
1d36197
fix docs sh
lghiur Dec 3, 2025
8da31df
update go mod
lghiur Dec 3, 2025
ffdaa13
Change module name to github.com/getkin/kin-openapi for replace compa…
lghiur Dec 3, 2025
2ff6118
Fix import ordering for CI linter
lghiur Dec 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 290 additions & 7 deletions .github/docs/openapi2.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,292 @@
type Header struct{ ... }
type Operation struct{ ... }
type Parameter struct{ ... }
package openapi2 // import "github.com/getkin/kin-openapi/openapi2"

Package openapi2 parses and writes OpenAPIv2 specification documents.

Does not cover all elements of OpenAPIv2. When OpenAPI version 3 is
backwards-compatible with version 2, version 3 elements have been used.

See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

TYPES

type Header struct {
Parameter
}

func (header Header) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of Header.

func (header *Header) UnmarshalJSON(data []byte) error
UnmarshalJSON sets Header to a copy of data.

type Operation struct {
Extensions map[string]any `json:"-" yaml:"-"`

Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Responses map[string]*Response `json:"responses" yaml:"responses"`
Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty"`
Produces []string `json:"produces,omitempty" yaml:"produces,omitempty"`
Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty"`
Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
}

func (operation Operation) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of Operation.

func (operation *Operation) UnmarshalJSON(data []byte) error
UnmarshalJSON sets Operation to a copy of data.

type Parameter struct {
Extensions map[string]any `json:"-" yaml:"-"`

Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`

In string `json:"in,omitempty" yaml:"in,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
CollectionFormat string `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
Type *openapi3.Types `json:"type,omitempty" yaml:"type,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
Items *SchemaRef `json:"items,omitempty" yaml:"items,omitempty"`
Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"`
MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
Minimum *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"`
Default any `json:"default,omitempty" yaml:"default,omitempty"`
}

func (parameter Parameter) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of Parameter.

func (parameter *Parameter) UnmarshalJSON(data []byte) error
UnmarshalJSON sets Parameter to a copy of data.

type Parameters []*Parameter
type PathItem struct{ ... }
type Response struct{ ... }

func (ps Parameters) Len() int

func (ps Parameters) Less(i, j int) bool

func (ps Parameters) Swap(i, j int)

type PathItem struct {
Extensions map[string]any `json:"-" yaml:"-"`

Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`

Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
Get *Operation `json:"get,omitempty" yaml:"get,omitempty"`
Head *Operation `json:"head,omitempty" yaml:"head,omitempty"`
Options *Operation `json:"options,omitempty" yaml:"options,omitempty"`
Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
Post *Operation `json:"post,omitempty" yaml:"post,omitempty"`
Put *Operation `json:"put,omitempty" yaml:"put,omitempty"`
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

func (pathItem *PathItem) GetOperation(method string) *Operation

func (pathItem PathItem) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of PathItem.

func (pathItem *PathItem) Operations() map[string]*Operation

func (pathItem *PathItem) SetOperation(method string, operation *Operation)

func (pathItem *PathItem) UnmarshalJSON(data []byte) error
UnmarshalJSON sets PathItem to a copy of data.

type Ref struct {
Ref string `json:"$ref" yaml:"$ref"`
}
Ref is specified by OpenAPI/Swagger 2.0 standard. See
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object

type Response struct {
Extensions map[string]any `json:"-" yaml:"-"`

Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`

Description string `json:"description,omitempty" yaml:"description,omitempty"`
Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
Examples map[string]any `json:"examples,omitempty" yaml:"examples,omitempty"`
}

func (response Response) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of Response.

func (response *Response) UnmarshalJSON(data []byte) error
UnmarshalJSON sets Response to a copy of data.

type Schema struct {
Extensions map[string]any `json:"-" yaml:"-"`

AllOf SchemaRefs `json:"allOf,omitempty" yaml:"allOf,omitempty"`
Not *SchemaRef `json:"not,omitempty" yaml:"not,omitempty"`
Type *openapi3.Types `json:"type,omitempty" yaml:"type,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"`
Default any `json:"default,omitempty" yaml:"default,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`

// Array-related, here for struct compactness
UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
// Number-related, here for struct compactness
ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
// Properties
ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
WriteOnly bool `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
XML *openapi3.XML `json:"xml,omitempty" yaml:"xml,omitempty"`

// Number
Min *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
Max *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`

// String
MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`

// Array
MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"`
MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
Items *SchemaRef `json:"items,omitempty" yaml:"items,omitempty"`

// Object
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
Properties Schemas `json:"properties,omitempty" yaml:"properties,omitempty"`
MinProps uint64 `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
MaxProps *uint64 `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
AdditionalProperties openapi3.AdditionalProperties `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
Discriminator string `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
}
Schema is specified by OpenAPI/Swagger 2.0 standard. See
https://swagger.io/specification/v2/#schema-object

func (schema Schema) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of Schema.

func (schema Schema) MarshalYAML() (any, error)
MarshalYAML returns the YAML encoding of Schema.

func (schema *Schema) UnmarshalJSON(data []byte) error
UnmarshalJSON sets Schema to a copy of data.

type SchemaRef struct {
// Extensions only captures fields starting with 'x-' as no other fields
// are allowed by the openapi spec.
Extensions map[string]any

Ref string
Value *Schema

// Has unexported fields.
}
SchemaRef represents either a Schema or a $ref to a Schema. When serializing
and both fields are set, Ref is preferred over Value.

func (x *SchemaRef) CollectionName() string
CollectionName returns the JSON string used for a collection of these
components.

func (x *SchemaRef) JSONLookup(token string) (any, error)
JSONLookup implements
https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable

func (x SchemaRef) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of SchemaRef.

func (x SchemaRef) MarshalYAML() (any, error)
MarshalYAML returns the YAML encoding of SchemaRef.

func (x *SchemaRef) RefPath() *url.URL
RefPath returns the path of the $ref relative to the root document.

func (x *SchemaRef) RefString() string
RefString returns the $ref value.

func (x *SchemaRef) UnmarshalJSON(data []byte) error
UnmarshalJSON sets SchemaRef to a copy of data.

type SchemaRefs []*SchemaRef

type Schemas map[string]*SchemaRef

type SecurityRequirements []map[string][]string
type SecurityScheme struct{ ... }
type T struct{ ... }

type SecurityScheme struct {
Extensions map[string]any `json:"-" yaml:"-"`

Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`

Description string `json:"description,omitempty" yaml:"description,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
In string `json:"in,omitempty" yaml:"in,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Flow string `json:"flow,omitempty" yaml:"flow,omitempty"`
AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
Scopes map[string]string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
}

func (securityScheme SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of SecurityScheme.

func (securityScheme *SecurityScheme) UnmarshalJSON(data []byte) error
UnmarshalJSON sets SecurityScheme to a copy of data.

type T struct {
Extensions map[string]any `json:"-" yaml:"-"`

Swagger string `json:"swagger" yaml:"swagger"` // required
Info openapi3.Info `json:"info" yaml:"info"` // required
ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty"`
Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty"`
Produces []string `json:"produces,omitempty" yaml:"produces,omitempty"`
Host string `json:"host,omitempty" yaml:"host,omitempty"`
BasePath string `json:"basePath,omitempty" yaml:"basePath,omitempty"`
Paths map[string]*PathItem `json:"paths,omitempty" yaml:"paths,omitempty"`
Definitions map[string]*SchemaRef `json:"definitions,omitempty" yaml:"definitions,omitempty"`
Parameters map[string]*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Responses map[string]*Response `json:"responses,omitempty" yaml:"responses,omitempty"`
SecurityDefinitions map[string]*SecurityScheme `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty"`
Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
}
T is the root of an OpenAPI v2 document

func (doc *T) AddOperation(path string, method string, operation *Operation)

func (doc T) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of T.

func (doc *T) UnmarshalJSON(data []byte) error
UnmarshalJSON sets T to a copy of data.

27 changes: 19 additions & 8 deletions .github/docs/openapi2conv.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
package openapi2conv // import "github.com/getkin/kin-openapi/openapi2conv"

Package openapi2conv converts an OpenAPI v2 specification document to v3.

FUNCTIONS

func FromV3(doc3 *openapi3.T) (*openapi2.T, error)
FromV3 converts an OpenAPIv3 spec to an OpenAPIv2 spec

func FromV3Headers(defs openapi3.Headers, components *openapi3.Components) (map[string]*openapi2.Header, error)
func FromV3Operation(doc3 *openapi3.T, operation *openapi3.Operation) (*openapi2.Operation, error)
func FromV3Parameter(ref *openapi3.ParameterRef, components *openapi3.Components) (*openapi2.Parameter, error)
func FromV3PathItem(doc3 *openapi3.T, pathItem *openapi3.PathItem) (*openapi2.PathItem, error)
func FromV3Ref(ref string) string
func FromV3RequestBody(name string, requestBodyRef *openapi3.RequestBodyRef, ...) (*openapi2.Parameter, error)
func FromV3RequestBody(name string, requestBodyRef *openapi3.RequestBodyRef, mediaType *openapi3.MediaType, components *openapi3.Components) (*openapi2.Parameter, error)
func FromV3RequestBodyFormData(mediaType *openapi3.MediaType) openapi2.Parameters
func FromV3Response(ref *openapi3.ResponseRef, components *openapi3.Components) (*openapi2.Response, error)
func FromV3Responses(responses map[string]*openapi3.ResponseRef, components *openapi3.Components) (map[string]*openapi2.Response, error)
func FromV3SchemaRef(schema *openapi3.SchemaRef, components *openapi3.Components) (*openapi3.SchemaRef, *openapi2.Parameter)
func FromV3Schemas(schemas map[string]*openapi3.SchemaRef, components *openapi3.Components) (map[string]*openapi3.SchemaRef, map[string]*openapi2.Parameter)
func FromV3SchemaRef(schema *openapi3.SchemaRef, components *openapi3.Components) (*openapi2.SchemaRef, *openapi2.Parameter)
func FromV3Schemas(schemas map[string]*openapi3.SchemaRef, components *openapi3.Components) (map[string]*openapi2.SchemaRef, map[string]*openapi2.Parameter)
func FromV3SecurityRequirements(requirements openapi3.SecurityRequirements) openapi2.SecurityRequirements
func FromV3SecurityScheme(doc3 *openapi3.T, ref *openapi3.SecuritySchemeRef) (*openapi2.SecurityScheme, error)
func ToV3(doc2 *openapi2.T) (*openapi3.T, error)
ToV3 converts an OpenAPIv2 spec to an OpenAPIv3 spec

func ToV3Headers(defs map[string]*openapi2.Header) openapi3.Headers
func ToV3Operation(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, ...) (*openapi3.Operation, error)
func ToV3Parameter(components *openapi3.Components, parameter *openapi2.Parameter, ...) (*openapi3.ParameterRef, *openapi3.RequestBodyRef, ...)
func ToV3PathItem(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, ...) (*openapi3.PathItem, error)
func ToV3Operation(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, operation *openapi2.Operation, consumes []string) (*openapi3.Operation, error)
func ToV3Parameter(components *openapi3.Components, parameter *openapi2.Parameter, consumes []string) (*openapi3.ParameterRef, *openapi3.RequestBodyRef, map[string]*openapi3.SchemaRef, error)
func ToV3PathItem(doc2 *openapi2.T, components *openapi3.Components, pathItem *openapi2.PathItem, consumes []string) (*openapi3.PathItem, error)
func ToV3Ref(ref string) string
func ToV3Response(response *openapi2.Response, produces []string) (*openapi3.ResponseRef, error)
func ToV3SchemaRef(schema *openapi3.SchemaRef) *openapi3.SchemaRef
func ToV3Schemas(defs map[string]*openapi3.SchemaRef) map[string]*openapi3.SchemaRef
func ToV3SchemaRef(schema *openapi2.SchemaRef) *openapi3.SchemaRef
func ToV3Schemas(defs map[string]*openapi2.SchemaRef) map[string]*openapi3.SchemaRef
func ToV3SecurityRequirements(requirements openapi2.SecurityRequirements) openapi3.SecurityRequirements
func ToV3SecurityScheme(securityScheme *openapi2.SecurityScheme) (*openapi3.SecuritySchemeRef, error)
func ToV3WithLoader(doc2 *openapi2.T, loader *openapi3.Loader, location *url.URL) (*openapi3.T, error)
Loading
Loading