Skip to content

Commit

Permalink
Possible fix for failing test that checks for validaiton methods
Browse files Browse the repository at this point in the history
  • Loading branch information
irees committed Aug 27, 2024
1 parent f9565e0 commit 3aa1f02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openapi3/ref.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package openapi3

import (
"context"
)

//go:generate go run refsgenerator.go

// Ref is specified by OpenAPI/Swagger 3.0 standard.
Expand All @@ -8,3 +12,9 @@ type Ref struct {
Ref string `json:"$ref" yaml:"$ref"`
Extensions map[string]any `json:"extensions,omitempty" yaml:"$ref,omitempty"`
}

// Validate returns an error if Extensions does not comply with the OpenAPI spec.
func (e *Ref) Validate(ctx context.Context, opts ...ValidationOption) error {
ctx = WithValidationOptions(ctx, opts...)
return validateExtensions(ctx, e.Extensions)
}

0 comments on commit 3aa1f02

Please sign in to comment.