|
Packit Service |
3a6627 |
package openapi3
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
import (
|
|
Packit Service |
3a6627 |
"context"
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
"github.com/getkin/kin-openapi/jsoninfo"
|
|
Packit Service |
3a6627 |
)
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type CallbackRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Callback
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *CallbackRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *CallbackRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *CallbackRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type ExampleRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Example
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ExampleRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ExampleRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ExampleRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
return nil
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type HeaderRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Header
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *HeaderRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *HeaderRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *HeaderRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type LinkRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Link
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *LinkRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *LinkRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *LinkRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type ParameterRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Parameter
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ParameterRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ParameterRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ParameterRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type ResponseRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Response
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ResponseRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ResponseRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *ResponseRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type RequestBodyRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *RequestBody
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *RequestBodyRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *RequestBodyRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *RequestBodyRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type SchemaRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *Schema
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func NewSchemaRef(ref string, value *Schema) *SchemaRef {
|
|
Packit Service |
3a6627 |
return &SchemaRef{
|
|
Packit Service |
3a6627 |
Ref: ref,
|
|
Packit Service |
3a6627 |
Value: value,
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SchemaRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SchemaRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SchemaRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
type SecuritySchemeRef struct {
|
|
Packit Service |
3a6627 |
Ref string
|
|
Packit Service |
3a6627 |
Value *SecurityScheme
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SecuritySchemeRef) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalRef(value.Ref, value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SecuritySchemeRef) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalRef(data, &value.Ref, &value.Value)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (value *SecuritySchemeRef) Validate(c context.Context) error {
|
|
Packit Service |
3a6627 |
v := value.Value
|
|
Packit Service |
3a6627 |
if v == nil {
|
|
Packit Service |
3a6627 |
return foundUnresolvedRef(value.Ref)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
return v.Validate(c)
|
|
Packit Service |
3a6627 |
}
|