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 Feb 1, 2024
1 parent d16d9d8 commit 568af23
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 @@ -180,6 +180,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 @@ -353,6 +357,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 @@ -437,6 +445,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 @@ -530,6 +542,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 @@ -823,6 +839,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 @@ -1047,6 +1067,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 @@ -1108,6 +1132,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 @@ -1395,6 +1423,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 @@ -1541,6 +1573,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 @@ -1722,6 +1758,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 @@ -1762,6 +1804,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 568af23

Please sign in to comment.