mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
Adding new low level models for OAS
This commit is contained in:
9
datamodel/low/3.0/components.go
Normal file
9
datamodel/low/3.0/components.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import "gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
type Components struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Schemas map[string]Schema
|
||||||
|
Responses map[string]Response
|
||||||
|
}
|
||||||
13
datamodel/low/3.0/contact.go
Normal file
13
datamodel/low/3.0/contact.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Contact struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Name low.NodeReference[string]
|
||||||
|
URL low.NodeReference[string]
|
||||||
|
Email low.NodeReference[string]
|
||||||
|
}
|
||||||
8
datamodel/low/3.0/document.go
Normal file
8
datamodel/low/3.0/document.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
type Document struct {
|
||||||
|
Version string
|
||||||
|
Info Info
|
||||||
|
Servers []Server
|
||||||
|
Components Components
|
||||||
|
}
|
||||||
15
datamodel/low/3.0/encoding.go
Normal file
15
datamodel/low/3.0/encoding.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Encoding struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
ContentType low.NodeReference[string]
|
||||||
|
Headers map[string]Parameter
|
||||||
|
Style low.NodeReference[string]
|
||||||
|
Explode low.NodeReference[bool]
|
||||||
|
AllowReserved low.NodeReference[bool]
|
||||||
|
}
|
||||||
15
datamodel/low/3.0/example.go
Normal file
15
datamodel/low/3.0/example.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Example struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Summary low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Value low.ObjectReference
|
||||||
|
ExternalValue low.NodeReference[string]
|
||||||
|
Extensions map[string]low.ObjectReference
|
||||||
|
}
|
||||||
16
datamodel/low/3.0/info.go
Normal file
16
datamodel/low/3.0/info.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Info struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Title low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
TermsOfService low.NodeReference[string]
|
||||||
|
Contact Contact
|
||||||
|
License License
|
||||||
|
Version low.NodeReference[string]
|
||||||
|
}
|
||||||
12
datamodel/low/3.0/license.go
Normal file
12
datamodel/low/3.0/license.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type License struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Name low.NodeReference[string]
|
||||||
|
URL low.NodeReference[string]
|
||||||
|
}
|
||||||
14
datamodel/low/3.0/media_type.go
Normal file
14
datamodel/low/3.0/media_type.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MediaType struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Schema Schema
|
||||||
|
Example low.ObjectReference
|
||||||
|
Examples map[string]Example
|
||||||
|
Encoding map[string]Encoding
|
||||||
|
}
|
||||||
16
datamodel/low/3.0/parameter.go
Normal file
16
datamodel/low/3.0/parameter.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Parameter struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Name low.NodeReference[string]
|
||||||
|
In low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Required low.NodeReference[bool]
|
||||||
|
Deprecated low.NodeReference[bool]
|
||||||
|
AllowEmptyValue low.NodeReference[bool]
|
||||||
|
}
|
||||||
13
datamodel/low/3.0/response.go
Normal file
13
datamodel/low/3.0/response.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Response struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Headers map[string]Parameter
|
||||||
|
Content map[string]MediaType
|
||||||
|
}
|
||||||
36
datamodel/low/3.0/schema.go
Normal file
36
datamodel/low/3.0/schema.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Schema struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Title low.NodeReference[string]
|
||||||
|
MultipleOf low.NodeReference[int]
|
||||||
|
Maximum low.NodeReference[int]
|
||||||
|
ExclusiveMaximum low.NodeReference[int]
|
||||||
|
Minimum low.NodeReference[int]
|
||||||
|
ExclusiveMinimum low.NodeReference[int]
|
||||||
|
MaxLength low.NodeReference[int]
|
||||||
|
MinLength low.NodeReference[int]
|
||||||
|
Pattern low.NodeReference[string]
|
||||||
|
MaxItems low.NodeReference[int]
|
||||||
|
MinItems low.NodeReference[int]
|
||||||
|
UniqueItems low.NodeReference[int]
|
||||||
|
MaxProperties low.NodeReference[int]
|
||||||
|
MinProperties low.NodeReference[int]
|
||||||
|
Required []low.NodeReference[string]
|
||||||
|
Enum []low.NodeReference[string]
|
||||||
|
Type low.NodeReference[string]
|
||||||
|
AllOf *Schema
|
||||||
|
OneOf *Schema
|
||||||
|
AnyOf *Schema
|
||||||
|
Not *Schema
|
||||||
|
Items *Schema
|
||||||
|
Properties map[string]*Schema
|
||||||
|
AdditionalProperties low.ObjectReference
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Default low.ObjectReference
|
||||||
|
}
|
||||||
9
datamodel/low/3.0/server.go
Normal file
9
datamodel/low/3.0/server.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
URL low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
Variables map[string]ServerVariable
|
||||||
|
}
|
||||||
13
datamodel/low/3.0/server_variable.go
Normal file
13
datamodel/low/3.0/server_variable.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ServerVariable struct {
|
||||||
|
Node *yaml.Node
|
||||||
|
Enum []low.NodeReference[string]
|
||||||
|
Default low.NodeReference[string]
|
||||||
|
Description low.NodeReference[string]
|
||||||
|
}
|
||||||
17
datamodel/low/reference.go
Normal file
17
datamodel/low/reference.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package low
|
||||||
|
|
||||||
|
import "gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
type HasNode interface {
|
||||||
|
GetNode() *yaml.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodeReference[T comparable] interface {
|
||||||
|
GetValue() T
|
||||||
|
GetNode() *yaml.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
type ObjectReference interface {
|
||||||
|
GetValue() interface{}
|
||||||
|
GetNode() *yaml.Node
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user