Skip to content

Commit

Permalink
rerun docs.sh and add ref_test.sh to github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmach committed Apr 12, 2024
1 parent 6b68d9b commit ba38d9a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/docs/openapi3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ func (callback *Callback) Value(key string) *PathItem
Value returns the callback for key or nil

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

Ref string
Value *Callback
// Has unexported fields.
Expand Down Expand Up @@ -357,6 +361,10 @@ func (example *Example) Validate(ctx context.Context, opts ...ValidationOption)
Validate returns an error if Example does not comply with the OpenAPI spec.

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

Ref string
Value *Example
// Has unexported fields.
Expand Down Expand Up @@ -441,6 +449,10 @@ func (header *Header) Validate(ctx context.Context, opts ...ValidationOption) er
Validate returns an error if Header does not comply with the OpenAPI spec.

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

Ref string
Value *Header
// Has unexported fields.
Expand Down Expand Up @@ -534,6 +546,10 @@ func (link *Link) Validate(ctx context.Context, opts ...ValidationOption) error
Validate returns an error if Link does not comply with the OpenAPI spec.

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

Ref string
Value *Link
// Has unexported fields.
Expand Down Expand Up @@ -830,6 +846,10 @@ func (parameter *Parameter) WithRequired(value bool) *Parameter
func (parameter *Parameter) WithSchema(value *Schema) *Parameter

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

Ref string
Value *Parameter
// Has unexported fields.
Expand Down Expand Up @@ -1057,6 +1077,10 @@ func (requestBody *RequestBody) WithSchema(value *Schema, consumes []string) *Re
func (requestBody *RequestBody) WithSchemaRef(value *SchemaRef, consumes []string) *RequestBody

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

Ref string
Value *RequestBody
// Has unexported fields.
Expand Down Expand Up @@ -1118,6 +1142,10 @@ func (m ResponseBodies) JSONLookup(token string) (interface{}, error)
https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable

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

Ref string
Value *Response
// Has unexported fields.
Expand Down Expand Up @@ -1410,6 +1438,10 @@ func (err *SchemaError) JSONPointer() []string
func (err SchemaError) Unwrap() error

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

Ref string
Value *Schema
// Has unexported fields.
Expand Down Expand Up @@ -1556,6 +1588,10 @@ func (ss *SecurityScheme) WithScheme(value string) *SecurityScheme
func (ss *SecurityScheme) WithType(value string) *SecurityScheme

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

Ref string
Value *SecurityScheme
// Has unexported fields.
Expand Down Expand Up @@ -1753,6 +1789,12 @@ type ValidationOption func(options *ValidationOptions)
ValidationOption allows the modification of how the OpenAPI document is
validated.

func AllowExtensionsWithRef() ValidationOption
AllowExtensionsWithRef allows extensions (fields starting with 'x-') as
siblings for $ref fields. This is the default. Non-extension fields are
prohibited unless allowed explicitly with the AllowExtraSiblingFields
option.

func AllowExtraSiblingFields(fields ...string) ValidationOption
AllowExtraSiblingFields called as AllowExtraSiblingFields("description")
makes Validate not return an error when said field appears next to a $ref.
Expand Down Expand Up @@ -1793,6 +1835,12 @@ func EnableSchemaPatternValidation() ValidationOption
DisableSchemaPatternValidation. By default, schema pattern validation is
enabled.

func ProhibitExtensionsWithRef() ValidationOption
ProhibitExtensionsWithRef causes the validation to return an error if
extensions (fields starting with 'x-') are found as siblings for $ref
fields. Non-extension fields are prohibited unless allowed explicitly with
the AllowExtraSiblingFields option.

type ValidationOptions struct {
// Has unexported fields.
}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
- run: ./refs.sh | tee openapi3/refs.go
- run: git --no-pager diff --exit-code

- run: ./refs_test.sh | tee openapi3/refs_test.go
- run: git --no-pager diff --exit-code

- run: ./maps.sh
- run: git --no-pager diff --exit-code

Expand Down

0 comments on commit ba38d9a

Please sign in to comment.