mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
Refactoring core structure of datamodel to accomodate v2 model.
There is a lot of overlap on these models, to create a much more sensible design, a new 'base' package has been added which contains shared models that both versions make use of.
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -72,7 +72,7 @@ func NewComponents(comp *low.Components) *Components {
|
|||||||
go buildComponent[*Parameter, *low.Parameter](parameters, k.Value, v.Value, paramChan, NewParameter)
|
go buildComponent[*Parameter, *low.Parameter](parameters, k.Value, v.Value, paramChan, NewParameter)
|
||||||
}
|
}
|
||||||
for k, v := range comp.Examples.Value {
|
for k, v := range comp.Examples.Value {
|
||||||
go buildComponent[*Example, *low.Example](parameters, k.Value, v.Value, exampleChan, NewExample)
|
go buildComponent[*Example, *base.Example](parameters, k.Value, v.Value, exampleChan, NewExample)
|
||||||
}
|
}
|
||||||
for k, v := range comp.RequestBodies.Value {
|
for k, v := range comp.RequestBodies.Value {
|
||||||
go buildComponent[*RequestBody, *low.RequestBody](requestBodies, k.Value, v.Value,
|
go buildComponent[*RequestBody, *low.RequestBody](requestBodies, k.Value, v.Value,
|
||||||
@@ -147,9 +147,9 @@ func buildComponent[N any, O any](comp int, key string, orig O, c chan component
|
|||||||
c <- componentResult[N]{comp: comp, res: f(orig), key: key}
|
c <- componentResult[N]{comp: comp, res: f(orig), key: key}
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSchema(key lowmodel.KeyReference[string], orig lowmodel.ValueReference[*shared.SchemaProxy], c chan componentResult[*SchemaProxy]) {
|
func buildSchema(key lowmodel.KeyReference[string], orig lowmodel.ValueReference[*base.SchemaProxy], c chan componentResult[*SchemaProxy]) {
|
||||||
var sch *SchemaProxy
|
var sch *SchemaProxy
|
||||||
sch = &SchemaProxy{schema: &lowmodel.NodeReference[*shared.SchemaProxy]{
|
sch = &SchemaProxy{schema: &lowmodel.NodeReference[*base.SchemaProxy]{
|
||||||
Value: orig.Value,
|
Value: orig.Value,
|
||||||
ValueNode: orig.ValueNode,
|
ValueNode: orig.ValueNode,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package v3
|
package v3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/shared"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Contact struct {
|
type Contact struct {
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
package v3
|
package v3
|
||||||
|
|
||||||
import low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
import (
|
||||||
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
|
)
|
||||||
|
|
||||||
type Discriminator struct {
|
type Discriminator struct {
|
||||||
PropertyName string
|
PropertyName string
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package v3
|
|||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Example struct {
|
type Example struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExternalDoc struct {
|
type ExternalDoc struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package v3
|
|||||||
import (
|
import (
|
||||||
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Header struct {
|
type Header struct {
|
||||||
@@ -36,7 +36,7 @@ func NewHeader(header *low.Header) *Header {
|
|||||||
h.Explode = header.Explode.Value
|
h.Explode = header.Explode.Value
|
||||||
h.AllowReserved = header.AllowReserved.Value
|
h.AllowReserved = header.AllowReserved.Value
|
||||||
if !header.Schema.IsEmpty() {
|
if !header.Schema.IsEmpty() {
|
||||||
h.Schema = &SchemaProxy{schema: &lowmodel.NodeReference[*shared.SchemaProxy]{
|
h.Schema = &SchemaProxy{schema: &lowmodel.NodeReference[*base.SchemaProxy]{
|
||||||
Value: header.Schema.Value,
|
Value: header.Schema.Value,
|
||||||
KeyNode: header.Schema.KeyNode,
|
KeyNode: header.Schema.KeyNode,
|
||||||
ValueNode: header.Schema.ValueNode,
|
ValueNode: header.Schema.ValueNode,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package v3
|
package v3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/shared"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Info struct {
|
type Info struct {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package v3
|
package v3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/shared"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type License struct {
|
type License struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package v3
|
|||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
lowmodel "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ type Schema struct {
|
|||||||
Example any
|
Example any
|
||||||
Deprecated bool
|
Deprecated bool
|
||||||
Extensions map[string]any
|
Extensions map[string]any
|
||||||
low *shared.Schema
|
low *base.Schema
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSchema(schema *shared.Schema) *Schema {
|
func NewSchema(schema *base.Schema) *Schema {
|
||||||
s := new(Schema)
|
s := new(Schema)
|
||||||
s.low = schema
|
s.low = schema
|
||||||
s.Title = schema.Title.Value
|
s.Title = schema.Title.Value
|
||||||
@@ -108,13 +108,13 @@ func NewSchema(schema *shared.Schema) *Schema {
|
|||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
|
|
||||||
// schema async
|
// schema async
|
||||||
buildOutSchema := func(schemas []lowmodel.ValueReference[*shared.SchemaProxy], items *[]*SchemaProxy,
|
buildOutSchema := func(schemas []lowmodel.ValueReference[*base.SchemaProxy], items *[]*SchemaProxy,
|
||||||
doneChan chan bool, e chan error) {
|
doneChan chan bool, e chan error) {
|
||||||
bChan := make(chan *SchemaProxy)
|
bChan := make(chan *SchemaProxy)
|
||||||
|
|
||||||
// for every item, build schema async
|
// for every item, build schema async
|
||||||
buildSchemaChild := func(sch lowmodel.ValueReference[*shared.SchemaProxy], bChan chan *SchemaProxy) {
|
buildSchemaChild := func(sch lowmodel.ValueReference[*base.SchemaProxy], bChan chan *SchemaProxy) {
|
||||||
p := &SchemaProxy{schema: &lowmodel.NodeReference[*shared.SchemaProxy]{
|
p := &SchemaProxy{schema: &lowmodel.NodeReference[*base.SchemaProxy]{
|
||||||
ValueNode: sch.ValueNode,
|
ValueNode: sch.ValueNode,
|
||||||
Value: sch.Value,
|
Value: sch.Value,
|
||||||
}}
|
}}
|
||||||
@@ -137,11 +137,11 @@ func NewSchema(schema *shared.Schema) *Schema {
|
|||||||
|
|
||||||
// props async
|
// props async
|
||||||
plock := sync.RWMutex{}
|
plock := sync.RWMutex{}
|
||||||
var buildProps = func(k lowmodel.KeyReference[string], v lowmodel.ValueReference[*shared.SchemaProxy], c chan bool,
|
var buildProps = func(k lowmodel.KeyReference[string], v lowmodel.ValueReference[*base.SchemaProxy], c chan bool,
|
||||||
props map[string]*SchemaProxy) {
|
props map[string]*SchemaProxy) {
|
||||||
defer plock.Unlock()
|
defer plock.Unlock()
|
||||||
plock.Lock()
|
plock.Lock()
|
||||||
props[k.Value] = &SchemaProxy{schema: &lowmodel.NodeReference[*shared.SchemaProxy]{
|
props[k.Value] = &SchemaProxy{schema: &lowmodel.NodeReference[*base.SchemaProxy]{
|
||||||
Value: v.Value,
|
Value: v.Value,
|
||||||
KeyNode: k.KeyNode,
|
KeyNode: k.KeyNode,
|
||||||
ValueNode: v.ValueNode,
|
ValueNode: v.ValueNode,
|
||||||
@@ -208,6 +208,6 @@ func NewSchema(schema *shared.Schema) *Schema {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Schema) GoLow() *shared.Schema {
|
func (s *Schema) GoLow() *base.Schema {
|
||||||
return s.low
|
return s.low
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
v3 "github.com/pb33f/libopenapi/datamodel/low/shared"
|
v3 "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SchemaProxy struct {
|
type SchemaProxy struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
v3 "github.com/pb33f/libopenapi/datamodel/low/shared"
|
v3 "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/high"
|
"github.com/pb33f/libopenapi/datamodel/high"
|
||||||
low "github.com/pb33f/libopenapi/datamodel/low/3.0"
|
low "github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type XML struct {
|
type XML struct {
|
||||||
|
|||||||
@@ -5,13 +5,21 @@ package v2
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Definitions struct {
|
type ParameterDefinitions struct {
|
||||||
Schemas low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*shared.SchemaProxy]]
|
Parameters low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Definitions) FindSchema(schema string) *low.ValueReference[*shared.SchemaProxy] {
|
type Definitions struct {
|
||||||
return low.FindItemInMap[*shared.SchemaProxy](schema, d.Schemas.Value)
|
Schemas low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.SchemaProxy]]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Definitions) FindSchema(schema string) *low.ValueReference[*base.SchemaProxy] {
|
||||||
|
return low.FindItemInMap[*base.SchemaProxy](schema, d.Schemas.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pd *ParameterDefinitions) FindSchema(schema string) *low.ValueReference[*Parameter] {
|
||||||
|
return low.FindItemInMap[*Parameter](schema, pd.Parameters.Value)
|
||||||
}
|
}
|
||||||
|
|||||||
45
datamodel/low/2.0/header.go
Normal file
45
datamodel/low/2.0/header.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"github.com/pb33f/libopenapi/index"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Header struct {
|
||||||
|
Type low.NodeReference[string]
|
||||||
|
Format low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Items low.NodeReference[*Items]
|
||||||
|
CollectionFormat low.NodeReference[string]
|
||||||
|
Default low.NodeReference[any]
|
||||||
|
Maximum low.NodeReference[int]
|
||||||
|
ExclusiveMaximum low.NodeReference[bool]
|
||||||
|
Minimum low.NodeReference[int]
|
||||||
|
ExclusiveMinimum low.NodeReference[bool]
|
||||||
|
MaxLength low.NodeReference[int]
|
||||||
|
MinLength low.NodeReference[int]
|
||||||
|
Pattern low.NodeReference[string]
|
||||||
|
MaxItems low.NodeReference[int]
|
||||||
|
MinItems low.NodeReference[int]
|
||||||
|
UniqueItems low.NodeReference[bool]
|
||||||
|
Enum low.NodeReference[[]string]
|
||||||
|
MultipleOf low.NodeReference[int]
|
||||||
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Header) FindExtension(ext string) *low.ValueReference[any] {
|
||||||
|
return low.FindItemInMap[any](ext, h.Extensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Header) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
||||||
|
h.Extensions = low.ExtractExtensions(root)
|
||||||
|
|
||||||
|
// TODO: build items.
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
16
datamodel/low/2.0/response.go
Normal file
16
datamodel/low/2.0/response.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Response struct {
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Schema low.NodeReference[*base.SchemaProxy]
|
||||||
|
Headers low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Header]]
|
||||||
|
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[any]]
|
||||||
|
}
|
||||||
11
datamodel/low/2.0/scopes.go
Normal file
11
datamodel/low/2.0/scopes.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v2
|
||||||
|
|
||||||
|
import "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
|
||||||
|
type Scopes struct {
|
||||||
|
Values low.NodeReference[map[low.KeyReference[string]]low.ValueReference[string]]
|
||||||
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
|
}
|
||||||
10
datamodel/low/2.0/security_requirement.go
Normal file
10
datamodel/low/2.0/security_requirement.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v2
|
||||||
|
|
||||||
|
import "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
|
||||||
|
type SecurityRequirement struct {
|
||||||
|
Values low.NodeReference[[]low.ValueReference[string]]
|
||||||
|
}
|
||||||
18
datamodel/low/2.0/security_scheme.go
Normal file
18
datamodel/low/2.0/security_scheme.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v2
|
||||||
|
|
||||||
|
import "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
|
||||||
|
type SecurityScheme struct {
|
||||||
|
Type low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Name low.NodeReference[string]
|
||||||
|
In low.NodeReference[string]
|
||||||
|
Flow low.NodeReference[string]
|
||||||
|
AuthorizationUrl low.NodeReference[string]
|
||||||
|
TokenUrl low.NodeReference[string]
|
||||||
|
Scopes low.NodeReference[*Scopes]
|
||||||
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
|
}
|
||||||
@@ -5,15 +5,26 @@ package v2
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Swagger struct {
|
type Swagger struct {
|
||||||
Swagger low.NodeReference[string]
|
Swagger low.NodeReference[string]
|
||||||
Info low.NodeReference[*shared.Info]
|
Info low.NodeReference[*base.Info]
|
||||||
Host low.NodeReference[string]
|
Host low.NodeReference[string]
|
||||||
BasePath low.NodeReference[string]
|
BasePath low.NodeReference[string]
|
||||||
Schemes low.KeyReference[[]low.ValueReference[string]]
|
Schemes low.NodeReference[[]low.ValueReference[string]]
|
||||||
Consumes low.KeyReference[[]low.ValueReference[string]]
|
Consumes low.NodeReference[[]low.ValueReference[string]]
|
||||||
Produces low.KeyReference[[]low.ValueReference[string]]
|
Produces low.NodeReference[[]low.ValueReference[string]]
|
||||||
|
|
||||||
|
// TODO: paths
|
||||||
|
|
||||||
|
Definitions low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.SchemaProxy]]
|
||||||
|
Parameters low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]]
|
||||||
|
Responses low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Response]]
|
||||||
|
SecurityDefinitions low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityScheme]]
|
||||||
|
Security low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityRequirement]]
|
||||||
|
Tags low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Tag]]
|
||||||
|
ExternalDocs low.NodeReference[*base.ExternalDoc]
|
||||||
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package v3
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -19,10 +19,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Components struct {
|
type Components struct {
|
||||||
Schemas low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*shared.SchemaProxy]]
|
Schemas low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.SchemaProxy]]
|
||||||
Responses low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Response]]
|
Responses low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Response]]
|
||||||
Parameters low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]]
|
Parameters low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]]
|
||||||
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]
|
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]
|
||||||
RequestBodies low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*RequestBody]]
|
RequestBodies low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*RequestBody]]
|
||||||
Headers low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Header]]
|
Headers low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Header]]
|
||||||
SecuritySchemes low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityScheme]]
|
SecuritySchemes low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityScheme]]
|
||||||
@@ -35,8 +35,8 @@ func (co *Components) FindExtension(ext string) *low.ValueReference[any] {
|
|||||||
return low.FindItemInMap[any](ext, co.Extensions)
|
return low.FindItemInMap[any](ext, co.Extensions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (co *Components) FindSchema(schema string) *low.ValueReference[*shared.SchemaProxy] {
|
func (co *Components) FindSchema(schema string) *low.ValueReference[*base.SchemaProxy] {
|
||||||
return low.FindItemInMap[*shared.SchemaProxy](schema, co.Schemas.Value)
|
return low.FindItemInMap[*base.SchemaProxy](schema, co.Schemas.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (co *Components) FindResponse(response string) *low.ValueReference[*Response] {
|
func (co *Components) FindResponse(response string) *low.ValueReference[*Response] {
|
||||||
@@ -51,8 +51,8 @@ func (co *Components) FindSecurityScheme(sScheme string) *low.ValueReference[*Se
|
|||||||
return low.FindItemInMap[*SecurityScheme](sScheme, co.SecuritySchemes.Value)
|
return low.FindItemInMap[*SecurityScheme](sScheme, co.SecuritySchemes.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (co *Components) FindExample(example string) *low.ValueReference[*Example] {
|
func (co *Components) FindExample(example string) *low.ValueReference[*base.Example] {
|
||||||
return low.FindItemInMap[*Example](example, co.Examples.Value)
|
return low.FindItemInMap[*base.Example](example, co.Examples.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (co *Components) FindRequestBody(requestBody string) *low.ValueReference[*RequestBody] {
|
func (co *Components) FindRequestBody(requestBody string) *low.ValueReference[*RequestBody] {
|
||||||
@@ -78,19 +78,19 @@ func (co *Components) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
skipChan := make(chan bool)
|
skipChan := make(chan bool)
|
||||||
errorChan := make(chan error)
|
errorChan := make(chan error)
|
||||||
paramChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]])
|
paramChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Parameter]])
|
||||||
schemaChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*shared.SchemaProxy]])
|
schemaChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.SchemaProxy]])
|
||||||
responsesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Response]])
|
responsesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Response]])
|
||||||
examplesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]])
|
examplesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]])
|
||||||
requestBodiesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*RequestBody]])
|
requestBodiesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*RequestBody]])
|
||||||
headersChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Header]])
|
headersChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Header]])
|
||||||
securitySchemesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityScheme]])
|
securitySchemesChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SecurityScheme]])
|
||||||
linkChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Link]])
|
linkChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Link]])
|
||||||
callbackChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Callback]])
|
callbackChan := make(chan low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Callback]])
|
||||||
|
|
||||||
go extractComponentValues[*shared.SchemaProxy](SchemasLabel, root, skipChan, errorChan, schemaChan, idx)
|
go extractComponentValues[*base.SchemaProxy](SchemasLabel, root, skipChan, errorChan, schemaChan, idx)
|
||||||
go extractComponentValues[*Parameter](ParametersLabel, root, skipChan, errorChan, paramChan, idx)
|
go extractComponentValues[*Parameter](ParametersLabel, root, skipChan, errorChan, paramChan, idx)
|
||||||
go extractComponentValues[*Response](ResponsesLabel, root, skipChan, errorChan, responsesChan, idx)
|
go extractComponentValues[*Response](ResponsesLabel, root, skipChan, errorChan, responsesChan, idx)
|
||||||
go extractComponentValues[*Example](ExamplesLabel, root, skipChan, errorChan, examplesChan, idx)
|
go extractComponentValues[*base.Example](base.ExamplesLabel, root, skipChan, errorChan, examplesChan, idx)
|
||||||
go extractComponentValues[*RequestBody](RequestBodiesLabel, root, skipChan, errorChan, requestBodiesChan, idx)
|
go extractComponentValues[*RequestBody](RequestBodiesLabel, root, skipChan, errorChan, requestBodiesChan, idx)
|
||||||
go extractComponentValues[*Header](HeadersLabel, root, skipChan, errorChan, headersChan, idx)
|
go extractComponentValues[*Header](HeadersLabel, root, skipChan, errorChan, headersChan, idx)
|
||||||
go extractComponentValues[*SecurityScheme](SecuritySchemesLabel, root, skipChan, errorChan, securitySchemesChan, idx)
|
go extractComponentValues[*SecurityScheme](SecuritySchemesLabel, root, skipChan, errorChan, securitySchemesChan, idx)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package v3
|
|||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel"
|
"github.com/pb33f/libopenapi/datamodel"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/resolver"
|
"github.com/pb33f/libopenapi/resolver"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
@@ -57,12 +57,12 @@ func CreateDocument(info *datamodel.SpecInfo) (*Document, []error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func extractInfo(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
func extractInfo(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
||||||
_, ln, vn := utils.FindKeyNodeFull(shared.InfoLabel, info.RootNode.Content)
|
_, ln, vn := utils.FindKeyNodeFull(base.InfoLabel, info.RootNode.Content)
|
||||||
if vn != nil {
|
if vn != nil {
|
||||||
ir := shared.Info{}
|
ir := base.Info{}
|
||||||
_ = low.BuildModel(vn, &ir)
|
_ = low.BuildModel(vn, &ir)
|
||||||
_ = ir.Build(vn, idx)
|
_ = ir.Build(vn, idx)
|
||||||
nr := low.NodeReference[*shared.Info]{Value: &ir, ValueNode: vn, KeyNode: ln}
|
nr := low.NodeReference[*base.Info]{Value: &ir, ValueNode: vn, KeyNode: ln}
|
||||||
doc.Info = nr
|
doc.Info = nr
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -78,7 +78,7 @@ func extractSecurity(info *datamodel.SpecInfo, doc *Document, idx *index.SpecInd
|
|||||||
}
|
}
|
||||||
|
|
||||||
func extractExternalDocs(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
func extractExternalDocs(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
||||||
extDocs, dErr := low.ExtractObject[*ExternalDoc](ExternalDocsLabel, info.RootNode, idx)
|
extDocs, dErr := low.ExtractObject[*base.ExternalDoc](base.ExternalDocsLabel, info.RootNode, idx)
|
||||||
if dErr != nil {
|
if dErr != nil {
|
||||||
return dErr
|
return dErr
|
||||||
}
|
}
|
||||||
@@ -128,24 +128,24 @@ func extractServers(info *datamodel.SpecInfo, doc *Document, idx *index.SpecInde
|
|||||||
}
|
}
|
||||||
|
|
||||||
func extractTags(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
func extractTags(info *datamodel.SpecInfo, doc *Document, idx *index.SpecIndex) error {
|
||||||
_, ln, vn := utils.FindKeyNodeFull(TagsLabel, info.RootNode.Content)
|
_, ln, vn := utils.FindKeyNodeFull(base.TagsLabel, info.RootNode.Content)
|
||||||
if vn != nil {
|
if vn != nil {
|
||||||
if utils.IsNodeArray(vn) {
|
if utils.IsNodeArray(vn) {
|
||||||
var tags []low.ValueReference[*Tag]
|
var tags []low.ValueReference[*base.Tag]
|
||||||
for _, tagN := range vn.Content {
|
for _, tagN := range vn.Content {
|
||||||
if utils.IsNodeMap(tagN) {
|
if utils.IsNodeMap(tagN) {
|
||||||
tag := Tag{}
|
tag := base.Tag{}
|
||||||
_ = low.BuildModel(tagN, &tag)
|
_ = low.BuildModel(tagN, &tag)
|
||||||
if err := tag.Build(tagN, idx); err != nil {
|
if err := tag.Build(tagN, idx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tags = append(tags, low.ValueReference[*Tag]{
|
tags = append(tags, low.ValueReference[*base.Tag]{
|
||||||
Value: &tag,
|
Value: &tag,
|
||||||
ValueNode: tagN,
|
ValueNode: tagN,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc.Tags = low.NodeReference[[]low.ValueReference[*Tag]]{
|
doc.Tags = low.NodeReference[[]low.ValueReference[*base.Tag]]{
|
||||||
Value: tags,
|
Value: tags,
|
||||||
KeyNode: ln,
|
KeyNode: ln,
|
||||||
ValueNode: vn,
|
ValueNode: vn,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel"
|
"github.com/pb33f/libopenapi/datamodel"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -470,7 +470,7 @@ func TestCreateDocument_CheckAdditionalProperties_Schema(t *testing.T) {
|
|||||||
components := doc.Components.Value
|
components := doc.Components.Value
|
||||||
d := components.FindSchema("Dressing")
|
d := components.FindSchema("Dressing")
|
||||||
assert.NotNil(t, d.Value.Schema().AdditionalProperties.Value)
|
assert.NotNil(t, d.Value.Schema().AdditionalProperties.Value)
|
||||||
if n, ok := d.Value.Schema().AdditionalProperties.Value.(*shared.Schema); ok {
|
if n, ok := d.Value.Schema().AdditionalProperties.Value.(*base.Schema); ok {
|
||||||
assert.Equal(t, "something in here.", n.Description.Value)
|
assert.Equal(t, "something in here.", n.Description.Value)
|
||||||
} else {
|
} else {
|
||||||
assert.Fail(t, "should be a schema")
|
assert.Fail(t, "should be a schema")
|
||||||
|
|||||||
@@ -5,19 +5,19 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Document struct {
|
type Document struct {
|
||||||
Version low.ValueReference[string]
|
Version low.ValueReference[string]
|
||||||
Info low.NodeReference[*shared.Info]
|
Info low.NodeReference[*base.Info]
|
||||||
Servers low.NodeReference[[]low.ValueReference[*Server]]
|
Servers low.NodeReference[[]low.ValueReference[*Server]]
|
||||||
Paths low.NodeReference[*Paths]
|
Paths low.NodeReference[*Paths]
|
||||||
Components low.NodeReference[*Components]
|
Components low.NodeReference[*Components]
|
||||||
Security low.NodeReference[*SecurityRequirement]
|
Security low.NodeReference[*SecurityRequirement]
|
||||||
Tags low.NodeReference[[]low.ValueReference[*Tag]]
|
Tags low.NodeReference[[]low.ValueReference[*base.Tag]]
|
||||||
ExternalDocs low.NodeReference[*ExternalDoc]
|
ExternalDocs low.NodeReference[*base.ExternalDoc]
|
||||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
Index *index.SpecIndex
|
Index *index.SpecIndex
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -23,9 +23,9 @@ type Header struct {
|
|||||||
Style low.NodeReference[string]
|
Style low.NodeReference[string]
|
||||||
Explode low.NodeReference[bool]
|
Explode low.NodeReference[bool]
|
||||||
AllowReserved low.NodeReference[bool]
|
AllowReserved low.NodeReference[bool]
|
||||||
Schema low.NodeReference[*shared.SchemaProxy]
|
Schema low.NodeReference[*base.SchemaProxy]
|
||||||
Example low.NodeReference[any]
|
Example low.NodeReference[any]
|
||||||
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]
|
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]
|
||||||
Content low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*MediaType]]
|
Content low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*MediaType]]
|
||||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
}
|
}
|
||||||
@@ -34,8 +34,8 @@ func (h *Header) FindExtension(ext string) *low.ValueReference[any] {
|
|||||||
return low.FindItemInMap[any](ext, h.Extensions)
|
return low.FindItemInMap[any](ext, h.Extensions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) FindExample(eType string) *low.ValueReference[*Example] {
|
func (h *Header) FindExample(eType string) *low.ValueReference[*base.Example] {
|
||||||
return low.FindItemInMap[*Example](eType, h.Examples.Value)
|
return low.FindItemInMap[*base.Example](eType, h.Examples.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) FindContent(ext string) *low.ValueReference[*MediaType] {
|
func (h *Header) FindContent(ext string) *low.ValueReference[*MediaType] {
|
||||||
@@ -46,18 +46,18 @@ func (h *Header) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
h.Extensions = low.ExtractExtensions(root)
|
h.Extensions = low.ExtractExtensions(root)
|
||||||
|
|
||||||
// handle example if set.
|
// handle example if set.
|
||||||
_, expLabel, expNode := utils.FindKeyNodeFull(ExampleLabel, root.Content)
|
_, expLabel, expNode := utils.FindKeyNodeFull(base.ExampleLabel, root.Content)
|
||||||
if expNode != nil {
|
if expNode != nil {
|
||||||
h.Example = low.ExtractExample(expNode, expLabel)
|
h.Example = low.ExtractExample(expNode, expLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle examples if set.
|
// handle examples if set.
|
||||||
exps, expsL, expsN, eErr := low.ExtractMapFlat[*Example](ExamplesLabel, root, idx)
|
exps, expsL, expsN, eErr := low.ExtractMapFlat[*base.Example](base.ExamplesLabel, root, idx)
|
||||||
if eErr != nil {
|
if eErr != nil {
|
||||||
return eErr
|
return eErr
|
||||||
}
|
}
|
||||||
if exps != nil {
|
if exps != nil {
|
||||||
h.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]{
|
h.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]{
|
||||||
Value: exps,
|
Value: exps,
|
||||||
KeyNode: expsL,
|
KeyNode: expsL,
|
||||||
ValueNode: expsN,
|
ValueNode: expsN,
|
||||||
@@ -65,7 +65,7 @@ func (h *Header) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle schema
|
// handle schema
|
||||||
sch, sErr := shared.ExtractSchema(root, idx)
|
sch, sErr := base.ExtractSchema(root, idx)
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
return sErr
|
return sErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MediaType struct {
|
type MediaType struct {
|
||||||
Schema low.NodeReference[*shared.SchemaProxy]
|
Schema low.NodeReference[*base.SchemaProxy]
|
||||||
Example low.NodeReference[any]
|
Example low.NodeReference[any]
|
||||||
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]
|
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]
|
||||||
Encoding low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Encoding]]
|
Encoding low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Encoding]]
|
||||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
}
|
}
|
||||||
@@ -27,11 +27,11 @@ func (mt *MediaType) FindPropertyEncoding(eType string) *low.ValueReference[*Enc
|
|||||||
return low.FindItemInMap[*Encoding](eType, mt.Encoding.Value)
|
return low.FindItemInMap[*Encoding](eType, mt.Encoding.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mt *MediaType) FindExample(eType string) *low.ValueReference[*Example] {
|
func (mt *MediaType) FindExample(eType string) *low.ValueReference[*base.Example] {
|
||||||
return low.FindItemInMap[*Example](eType, mt.Examples.Value)
|
return low.FindItemInMap[*base.Example](eType, mt.Examples.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mt *MediaType) GetAllExamples() map[low.KeyReference[string]]low.ValueReference[*Example] {
|
func (mt *MediaType) GetAllExamples() map[low.KeyReference[string]]low.ValueReference[*base.Example] {
|
||||||
return mt.Examples.Value
|
return mt.Examples.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,13 +39,13 @@ func (mt *MediaType) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
mt.Extensions = low.ExtractExtensions(root)
|
mt.Extensions = low.ExtractExtensions(root)
|
||||||
|
|
||||||
// handle example if set.
|
// handle example if set.
|
||||||
_, expLabel, expNode := utils.FindKeyNodeFull(ExampleLabel, root.Content)
|
_, expLabel, expNode := utils.FindKeyNodeFull(base.ExampleLabel, root.Content)
|
||||||
if expNode != nil {
|
if expNode != nil {
|
||||||
mt.Example = low.NodeReference[any]{Value: expNode.Value, KeyNode: expLabel, ValueNode: expNode}
|
mt.Example = low.NodeReference[any]{Value: expNode.Value, KeyNode: expLabel, ValueNode: expNode}
|
||||||
}
|
}
|
||||||
|
|
||||||
//handle schema
|
//handle schema
|
||||||
sch, sErr := shared.ExtractSchema(root, idx)
|
sch, sErr := base.ExtractSchema(root, idx)
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
return sErr
|
return sErr
|
||||||
}
|
}
|
||||||
@@ -54,12 +54,12 @@ func (mt *MediaType) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle examples if set.
|
// handle examples if set.
|
||||||
exps, expsL, expsN, eErr := low.ExtractMapFlat[*Example](ExamplesLabel, root, idx)
|
exps, expsL, expsN, eErr := low.ExtractMapFlat[*base.Example](base.ExamplesLabel, root, idx)
|
||||||
if eErr != nil {
|
if eErr != nil {
|
||||||
return eErr
|
return eErr
|
||||||
}
|
}
|
||||||
if exps != nil {
|
if exps != nil {
|
||||||
mt.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]{
|
mt.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]{
|
||||||
Value: exps,
|
Value: exps,
|
||||||
KeyNode: expsL,
|
KeyNode: expsL,
|
||||||
ValueNode: expsN,
|
ValueNode: expsN,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
@@ -21,7 +22,7 @@ type Operation struct {
|
|||||||
Tags low.NodeReference[[]low.ValueReference[string]]
|
Tags low.NodeReference[[]low.ValueReference[string]]
|
||||||
Summary low.NodeReference[string]
|
Summary low.NodeReference[string]
|
||||||
Description low.NodeReference[string]
|
Description low.NodeReference[string]
|
||||||
ExternalDocs low.NodeReference[*ExternalDoc]
|
ExternalDocs low.NodeReference[*base.ExternalDoc]
|
||||||
OperationId low.NodeReference[string]
|
OperationId low.NodeReference[string]
|
||||||
Parameters low.NodeReference[[]low.ValueReference[*Parameter]]
|
Parameters low.NodeReference[[]low.ValueReference[*Parameter]]
|
||||||
RequestBody low.NodeReference[*RequestBody]
|
RequestBody low.NodeReference[*RequestBody]
|
||||||
@@ -41,7 +42,7 @@ func (o *Operation) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
o.Extensions = low.ExtractExtensions(root)
|
o.Extensions = low.ExtractExtensions(root)
|
||||||
|
|
||||||
// extract externalDocs
|
// extract externalDocs
|
||||||
extDocs, dErr := low.ExtractObject[*ExternalDoc](ExternalDocsLabel, root, idx)
|
extDocs, dErr := low.ExtractObject[*base.ExternalDoc](base.ExternalDocsLabel, root, idx)
|
||||||
if dErr != nil {
|
if dErr != nil {
|
||||||
return dErr
|
return dErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ package v3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/shared"
|
"github.com/pb33f/libopenapi/datamodel/low/base"
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SchemaLabel = "schema"
|
|
||||||
ContentLabel = "content"
|
ContentLabel = "content"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,9 +25,9 @@ type Parameter struct {
|
|||||||
Style low.NodeReference[string]
|
Style low.NodeReference[string]
|
||||||
Explode low.NodeReference[bool]
|
Explode low.NodeReference[bool]
|
||||||
AllowReserved low.NodeReference[bool]
|
AllowReserved low.NodeReference[bool]
|
||||||
Schema low.NodeReference[*shared.SchemaProxy]
|
Schema low.NodeReference[*base.SchemaProxy]
|
||||||
Example low.NodeReference[any]
|
Example low.NodeReference[any]
|
||||||
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]
|
Examples low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]
|
||||||
Content low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*MediaType]]
|
Content low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*MediaType]]
|
||||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
}
|
}
|
||||||
@@ -37,8 +36,8 @@ func (p *Parameter) FindContent(cType string) *low.ValueReference[*MediaType] {
|
|||||||
return low.FindItemInMap[*MediaType](cType, p.Content.Value)
|
return low.FindItemInMap[*MediaType](cType, p.Content.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Parameter) FindExample(eType string) *low.ValueReference[*Example] {
|
func (p *Parameter) FindExample(eType string) *low.ValueReference[*base.Example] {
|
||||||
return low.FindItemInMap[*Example](eType, p.Examples.Value)
|
return low.FindItemInMap[*base.Example](eType, p.Examples.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Parameter) FindExtension(ext string) *low.ValueReference[any] {
|
func (p *Parameter) FindExtension(ext string) *low.ValueReference[any] {
|
||||||
@@ -49,13 +48,13 @@ func (p *Parameter) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
p.Extensions = low.ExtractExtensions(root)
|
p.Extensions = low.ExtractExtensions(root)
|
||||||
|
|
||||||
// handle example if set.
|
// handle example if set.
|
||||||
_, expLabel, expNode := utils.FindKeyNodeFull(ExampleLabel, root.Content)
|
_, expLabel, expNode := utils.FindKeyNodeFull(base.ExampleLabel, root.Content)
|
||||||
if expNode != nil {
|
if expNode != nil {
|
||||||
p.Example = low.ExtractExample(expNode, expLabel)
|
p.Example = low.ExtractExample(expNode, expLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle schema
|
// handle schema
|
||||||
sch, sErr := shared.ExtractSchema(root, idx)
|
sch, sErr := base.ExtractSchema(root, idx)
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
return sErr
|
return sErr
|
||||||
}
|
}
|
||||||
@@ -64,12 +63,12 @@ func (p *Parameter) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle examples if set.
|
// handle examples if set.
|
||||||
exps, expsL, expsN, eErr := low.ExtractMapFlat[*Example](ExamplesLabel, root, idx)
|
exps, expsL, expsN, eErr := low.ExtractMapFlat[*base.Example](base.ExamplesLabel, root, idx)
|
||||||
if eErr != nil {
|
if eErr != nil {
|
||||||
return eErr
|
return eErr
|
||||||
}
|
}
|
||||||
if exps != nil {
|
if exps != nil {
|
||||||
p.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*Example]]{
|
p.Examples = low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*base.Example]]{
|
||||||
Value: exps,
|
Value: exps,
|
||||||
KeyNode: expsL,
|
KeyNode: expsL,
|
||||||
ValueNode: expsN,
|
ValueNode: expsN,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
"github.com/pb33f/libopenapi/datamodel/low/3.0"
|
|
||||||
"github.com/pb33f/libopenapi/index"
|
"github.com/pb33f/libopenapi/index"
|
||||||
"github.com/pb33f/libopenapi/utils"
|
"github.com/pb33f/libopenapi/utils"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -20,6 +19,7 @@ const (
|
|||||||
OneOfLabel = "oneOf"
|
OneOfLabel = "oneOf"
|
||||||
NotLabel = "not"
|
NotLabel = "not"
|
||||||
DiscriminatorLabel = "discriminator"
|
DiscriminatorLabel = "discriminator"
|
||||||
|
SchemaLabel = "schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Schema struct {
|
type Schema struct {
|
||||||
@@ -51,11 +51,11 @@ type Schema struct {
|
|||||||
Description low.NodeReference[string]
|
Description low.NodeReference[string]
|
||||||
Default low.NodeReference[any]
|
Default low.NodeReference[any]
|
||||||
Nullable low.NodeReference[bool]
|
Nullable low.NodeReference[bool]
|
||||||
Discriminator low.NodeReference[*v3.Discriminator]
|
Discriminator low.NodeReference[*Discriminator]
|
||||||
ReadOnly low.NodeReference[bool]
|
ReadOnly low.NodeReference[bool]
|
||||||
WriteOnly low.NodeReference[bool]
|
WriteOnly low.NodeReference[bool]
|
||||||
XML low.NodeReference[*v3.XML]
|
XML low.NodeReference[*XML]
|
||||||
ExternalDocs low.NodeReference[*v3.ExternalDoc]
|
ExternalDocs low.NodeReference[*ExternalDoc]
|
||||||
Example low.NodeReference[any]
|
Example low.NodeReference[any]
|
||||||
Deprecated low.NodeReference[bool]
|
Deprecated low.NodeReference[bool]
|
||||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||||
@@ -84,9 +84,9 @@ func (s *Schema) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
s.extractExtensions(root)
|
s.extractExtensions(root)
|
||||||
|
|
||||||
// handle example if set.
|
// handle example if set.
|
||||||
_, expLabel, expNode := utils.FindKeyNodeFull(v3.ExampleLabel, root.Content)
|
_, expLabel, expNode := utils.FindKeyNodeFull(ExampleLabel, root.Content)
|
||||||
if expNode != nil {
|
if expNode != nil {
|
||||||
s.Example = low.NodeReference[any]{Value: v3.ExtractExampleValue(expNode), KeyNode: expLabel, ValueNode: expNode}
|
s.Example = low.NodeReference[any]{Value: ExtractExampleValue(expNode), KeyNode: expLabel, ValueNode: expNode}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, addPLabel, addPNode := utils.FindKeyNodeFull(AdditionalPropertiesLabel, root.Content)
|
_, addPLabel, addPNode := utils.FindKeyNodeFull(AdditionalPropertiesLabel, root.Content)
|
||||||
@@ -108,28 +108,28 @@ func (s *Schema) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
|||||||
// handle discriminator if set.
|
// handle discriminator if set.
|
||||||
_, discLabel, discNode := utils.FindKeyNodeFull(DiscriminatorLabel, root.Content)
|
_, discLabel, discNode := utils.FindKeyNodeFull(DiscriminatorLabel, root.Content)
|
||||||
if discNode != nil {
|
if discNode != nil {
|
||||||
var discriminator v3.Discriminator
|
var discriminator Discriminator
|
||||||
_ = low.BuildModel(discNode, &discriminator)
|
_ = low.BuildModel(discNode, &discriminator)
|
||||||
s.Discriminator = low.NodeReference[*v3.Discriminator]{Value: &discriminator, KeyNode: discLabel, ValueNode: discNode}
|
s.Discriminator = low.NodeReference[*Discriminator]{Value: &discriminator, KeyNode: discLabel, ValueNode: discNode}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle externalDocs if set.
|
// handle externalDocs if set.
|
||||||
_, extDocLabel, extDocNode := utils.FindKeyNodeFull(v3.ExternalDocsLabel, root.Content)
|
_, extDocLabel, extDocNode := utils.FindKeyNodeFull(ExternalDocsLabel, root.Content)
|
||||||
if extDocNode != nil {
|
if extDocNode != nil {
|
||||||
var exDoc v3.ExternalDoc
|
var exDoc ExternalDoc
|
||||||
_ = low.BuildModel(extDocNode, &exDoc)
|
_ = low.BuildModel(extDocNode, &exDoc)
|
||||||
_ = exDoc.Build(extDocNode, idx) // throws no errors, can't check for one.
|
_ = exDoc.Build(extDocNode, idx) // throws no errors, can't check for one.
|
||||||
s.ExternalDocs = low.NodeReference[*v3.ExternalDoc]{Value: &exDoc, KeyNode: extDocLabel, ValueNode: extDocNode}
|
s.ExternalDocs = low.NodeReference[*ExternalDoc]{Value: &exDoc, KeyNode: extDocLabel, ValueNode: extDocNode}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle xml if set.
|
// handle xml if set.
|
||||||
_, xmlLabel, xmlNode := utils.FindKeyNodeFull(XMLLabel, root.Content)
|
_, xmlLabel, xmlNode := utils.FindKeyNodeFull(XMLLabel, root.Content)
|
||||||
if xmlNode != nil {
|
if xmlNode != nil {
|
||||||
var xml v3.XML
|
var xml XML
|
||||||
_ = low.BuildModel(xmlNode, &xml)
|
_ = low.BuildModel(xmlNode, &xml)
|
||||||
// extract extensions if set.
|
// extract extensions if set.
|
||||||
_ = xml.Build(xmlNode) // returns no errors, can't check for one.
|
_ = xml.Build(xmlNode) // returns no errors, can't check for one.
|
||||||
s.XML = low.NodeReference[*v3.XML]{Value: &xml, KeyNode: xmlLabel, ValueNode: xmlNode}
|
s.XML = low.NodeReference[*XML]{Value: &xml, KeyNode: xmlLabel, ValueNode: xmlNode}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for property, build in a new thread!
|
// for property, build in a new thread!
|
||||||
@@ -406,7 +406,7 @@ func ExtractSchema(root *yaml.Node, idx *index.SpecIndex) (*low.NodeReference[*S
|
|||||||
root.Content[1].Value, root.Content[1].Line, root.Content[1].Column)
|
root.Content[1].Value, root.Content[1].Line, root.Content[1].Column)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, schLabel, schNode = utils.FindKeyNodeFull(v3.SchemaLabel, root.Content)
|
_, schLabel, schNode = utils.FindKeyNodeFull(SchemaLabel, root.Content)
|
||||||
if schNode != nil {
|
if schNode != nil {
|
||||||
if h, _, _ := utils.IsNodeRefValue(schNode); h {
|
if h, _, _ := utils.IsNodeRefValue(schNode); h {
|
||||||
ref, _ := low.LocateRefNode(schNode, idx)
|
ref, _ := low.LocateRefNode(schNode, idx)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package shared
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package v3
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -8729,7 +8729,7 @@ components:
|
|||||||
nullable: true
|
nullable: true
|
||||||
type: string
|
type: string
|
||||||
team:
|
team:
|
||||||
description: "*Create-only*. The team that this project is shared with. This field only exists for projects in organizations."
|
description: "*Create-only*. The team that this project is base with. This field only exists for projects in organizations."
|
||||||
example: "12345"
|
example: "12345"
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
@@ -8800,7 +8800,7 @@ components:
|
|||||||
team:
|
team:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/components/schemas/TeamCompact"
|
- $ref: "#/components/schemas/TeamCompact"
|
||||||
- description: "*Create-only*. The team that this project is shared with. This field only exists for projects in organizations."
|
- description: "*Create-only*. The team that this project is base with. This field only exists for projects in organizations."
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
ProjectSectionInsertRequest:
|
ProjectSectionInsertRequest:
|
||||||
|
|||||||
Reference in New Issue
Block a user