Documentation ¶
Overview ¶
Package jsonschema GENERATED BY gengo:deepcopy DON'T EDIT THIS FILE
Package jsonschema GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
Index ¶
- Constants
- Variables
- func IsType[T Schema](s any) bool
- func Print(w io.Writer, fn func(p Printer))
- func Unmarshal(data []byte, v any) error
- type AnchorString
- type AnyType
- type ArrayType
- type BooleanType
- type CanSwaggerDoc
- type Core
- type Discriminator
- type EnumType
- type Ext
- type GoEnumValues
- type GoTaggedUnionType
- type GoUnionType
- type IntersectionType
- type Metadata
- type NullType
- type NumberType
- type ObjectType
- type OpenAPISchemaFormatGetter
- type OpenAPISchemaGetter
- type OpenAPISchemaTypeGetter
- type Payload
- type Printer
- type PrinterTo
- type Props
- func (p *Props) Delete(key string) (didDelete bool)
- func (p *Props) Get(key string) (Schema, bool)
- func (p Props) IsZero() bool
- func (p *Props) KeyValues() iter.Seq2[string, Schema]
- func (p *Props) Len() int
- func (p Props) MarshalJSONV2(encoder *jsontext.Encoder, options json.Options) error
- func (Props) RuntimeDoc(names ...string) ([]string, bool)
- func (p *Props) Set(key string, value Schema) bool
- func (props *Props) UnmarshalJSONV2(d *jsontext.Decoder, options json.Options) error
- type RefType
- type Refer
- type Schema
- type SchemaPrintOption
- type StringType
- type URIReferenceString
- type URIString
- type UnionType
Constants ¶
View Source
const ( XEnumLabels = `x-enum-labels` XGoType = `x-go-type` XGoVendorType = `x-go-vendor-type` XGoStarLevel = `x-go-star-level` XGoFieldName = `x-go-field-name` XTagValidate = `x-tag-validate` )
Variables ¶
View Source
var ErrInvalidJSONSchemaObject = errors.New("invalid json schema object")
View Source
var ErrInvalidJSONSchemaType = errors.New("invalid json schema type")
Functions ¶
Types ¶
type AnchorString ¶
type AnchorString string
openapi:strfmt anchor
func (AnchorString) OpenAPISchema ¶
func (AnchorString) OpenAPISchema() Schema
func (AnchorString) RuntimeDoc ¶
func (AnchorString) RuntimeDoc(names ...string) ([]string, bool)
func (*AnchorString) UmarshalText ¶
func (s *AnchorString) UmarshalText(text []byte) error
type ArrayType ¶
type BooleanType ¶
func Boolean ¶
func Boolean() *BooleanType
func (BooleanType) PrintTo ¶
func (BooleanType) PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
func (BooleanType) RuntimeDoc ¶
func (v BooleanType) RuntimeDoc(names ...string) ([]string, bool)
type CanSwaggerDoc ¶
interface of k8s pkgs
type Core ¶
type Core struct { // default https://json-schema.org/draft/2020-12/schema Schema *URIString `json:"$schema,omitzero"` ID *URIReferenceString `json:"$id,omitzero"` Comment string `json:"$comment,omitzero"` Vocabulary map[URIString]bool `json:"$vocabulary,omitzero"` // https://json-schema.org/understanding-json-schema/structuring#anchor Anchor string `json:"$anchor,omitzero"` // for generics type // https://json-schema.org/blog/posts/dynamicref-and-generics DynamicAnchor string `json:"$dynamicAnchor,omitzero"` Defs map[string]Schema `json:"$defs,omitzero"` }
type Discriminator ¶
type Discriminator struct { PropertyName string `json:"propertyName"` Mapping map[string]Schema `json:"mapping,omitzero"` }
func (Discriminator) RuntimeDoc ¶
func (v Discriminator) RuntimeDoc(names ...string) ([]string, bool)
type GoEnumValues ¶
type GoEnumValues interface {
EnumValues() []any
}
type GoTaggedUnionType ¶
type GoTaggedUnionType = validatortaggedunion.Type
type GoUnionType ¶
type GoUnionType interface {
OneOf() []any
}
type IntersectionType ¶
func AllOf ¶
func AllOf(schemas ...Schema) *IntersectionType
func (IntersectionType) PrintTo ¶
func (t IntersectionType) PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
func (IntersectionType) RuntimeDoc ¶
func (v IntersectionType) RuntimeDoc(names ...string) ([]string, bool)
type Metadata ¶
type Metadata struct { Title string `json:"title,omitzero"` Description string `json:"description,omitzero"` Default any `json:"default,omitzero"` WriteOnly *bool `json:"writeOnly,omitzero"` ReadOnly *bool `json:"readOnly,omitzero"` Examples []any `json:"examples,omitzero"` Deprecated *bool `json:"deprecated,omitzero"` Ext }
+gengo:deepcopy
func (*Metadata) DeepCopyInto ¶
func (*Metadata) GetMetadata ¶
type NumberType ¶
type NumberType struct { Type string `json:"type,omitzero"` // validate MultipleOf *float64 `json:"multipleOf,omitzero"` Maximum *float64 `json:"maximum,omitzero"` ExclusiveMaximum *float64 `json:"exclusiveMaximum,omitzero"` Minimum *float64 `json:"minimum,omitzero"` ExclusiveMinimum *float64 `json:"exclusiveMinimum,omitzero"` Core Metadata }
func (NumberType) PrintTo ¶
func (t NumberType) PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
func (NumberType) RuntimeDoc ¶
func (v NumberType) RuntimeDoc(names ...string) ([]string, bool)
type ObjectType ¶
type ObjectType struct { Type string `json:"type,omitzero"` Properties Props `json:"properties,omitzero"` PropertyNames Schema `json:"propertyNames,omitzero"` AdditionalProperties Schema `json:"additionalProperties,omitzero"` // validate Required []string `json:"required,omitzero"` MaxProperties *uint64 `json:"maxProperties,omitzero"` MinProperties *uint64 `json:"minProperties,omitzero"` Core Metadata }
func MapOf ¶
func MapOf(v Schema) *ObjectType
func RecordOf ¶
func RecordOf(k Schema, v Schema) *ObjectType
func (ObjectType) PrintTo ¶
func (t ObjectType) PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
func (ObjectType) RuntimeDoc ¶
func (v ObjectType) RuntimeDoc(names ...string) ([]string, bool)
func (*ObjectType) SetProperty ¶
func (t *ObjectType) SetProperty(name string, schema Schema, required bool)
type OpenAPISchemaFormatGetter ¶
type OpenAPISchemaFormatGetter interface {
OpenAPISchemaFormat() string
}
type OpenAPISchemaGetter ¶
type OpenAPISchemaGetter interface {
OpenAPISchema() Schema
}
type OpenAPISchemaTypeGetter ¶
type OpenAPISchemaTypeGetter interface {
OpenAPISchemaType() []string
}
type Payload ¶
type Payload struct {
Schema
}
func (Payload) MarshalJSON ¶
func (*Payload) UnmarshalJSON ¶
type PrinterTo ¶
type PrinterTo interface {
PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
}
type Props ¶
type Props struct {
// contains filtered or unexported fields
}
func (Props) MarshalJSONV2 ¶
type RefType ¶
type RefType struct { Ref *URIReferenceString `json:"$ref,omitzero"` DynamicRef *URIReferenceString `json:"$dynamicRef,omitzero"` Core Metadata }
type Schema ¶
type Schema interface { GetCore() *Core GetMetadata() *Metadata PrintTo(w io.Writer, optionFns ...SchemaPrintOption) }
type SchemaPrintOption ¶
type SchemaPrintOption func(o *printOption)
func PrintWithDoc ¶
func PrintWithDoc() SchemaPrintOption
func (SchemaPrintOption) RuntimeDoc ¶
func (SchemaPrintOption) RuntimeDoc(names ...string) ([]string, bool)
type StringType ¶
type StringType struct { Type string `json:"type,omitzero"` Format string `json:"format,omitzero"` // validate MaxLength *uint64 `json:"maxLength,omitzero"` MinLength *uint64 `json:"minLength,omitzero"` Pattern string `json:"pattern,omitzero"` Core Metadata }
func Binary ¶
func Binary() *StringType
func Bytes ¶
func Bytes() *StringType
func String ¶
func String() *StringType
func (StringType) PrintTo ¶
func (t StringType) PrintTo(w io.Writer, optionFns ...SchemaPrintOption)
func (StringType) RuntimeDoc ¶
func (v StringType) RuntimeDoc(names ...string) ([]string, bool)
type URIReferenceString ¶
openapi:strfmt uri-reference
func ParseURIReferenceString ¶
func ParseURIReferenceString(u string) (*URIReferenceString, error)
func (URIReferenceString) MarshalText ¶
func (u URIReferenceString) MarshalText() ([]byte, error)
func (*URIReferenceString) RefName ¶
func (u *URIReferenceString) RefName() string
func (URIReferenceString) RuntimeDoc ¶
func (v URIReferenceString) RuntimeDoc(names ...string) ([]string, bool)
func (*URIReferenceString) UnmarshalText ¶
func (u *URIReferenceString) UnmarshalText(b []byte) error
type URIString ¶
openapi:strfmt uri
func (URIString) MarshalText ¶
func (*URIString) UnmarshalText ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package extractors GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
|
Package extractors GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE |
Click to show internal directories.
Click to hide internal directories.