Skip to content

Commit

Permalink
Fixed linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
JemDay committed Dec 19, 2024
1 parent 95f1057 commit 8b9e667
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Option func(*ValidationOptions)

// NewValidationOptions creates a new ValidationOptions instance with default values.
func NewValidationOptions(opts ...Option) *ValidationOptions {

// Create the set of default values
o := &ValidationOptions{}

Expand Down
2 changes: 0 additions & 2 deletions parameters/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ type ParameterValidator interface {

// NewParameterValidator will create a new ParameterValidator from an OpenAPI 3+ document
func NewParameterValidator(document *v3.Document, opts ...config.Option) ParameterValidator {

options := config.NewValidationOptions(opts...)

return &paramValidator{options: options, document: document}

}

type paramValidator struct {
Expand Down
2 changes: 0 additions & 2 deletions requests/request_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ type RequestBodyValidator interface {

// NewRequestBodyValidator will create a new RequestBodyValidator from an OpenAPI 3+ document
func NewRequestBodyValidator(document *v3.Document, opts ...config.Option) RequestBodyValidator {

options := config.NewValidationOptions(opts...)

return &requestBodyValidator{options: options, document: document, schemaCache: &sync.Map{}}

}

type schemaCache struct {
Expand Down
3 changes: 1 addition & 2 deletions requests/validate_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ func ValidateRequestSchema(
jsonSchema []byte,
opts ...config.Option,
) (bool, []*errors.ValidationError) {

options := config.NewValidationOptions()
options := config.NewValidationOptions(opts...)

var validationErrors []*errors.ValidationError

Expand Down
2 changes: 0 additions & 2 deletions responses/response_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ type ResponseBodyValidator interface {

// NewResponseBodyValidator will create a new ResponseBodyValidator from an OpenAPI 3+ document
func NewResponseBodyValidator(document *v3.Document, opts ...config.Option) ResponseBodyValidator {

options := config.NewValidationOptions(opts...)

return &responseBodyValidator{options: options, document: document, schemaCache: &sync.Map{}}

}

type schemaCache struct {
Expand Down
1 change: 0 additions & 1 deletion responses/validate_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func ValidateResponseSchema(
jsonSchema []byte,
opts ...config.Option,
) (bool, []*errors.ValidationError) {

options := config.NewValidationOptions(opts...)

var validationErrors []*errors.ValidationError
Expand Down
1 change: 0 additions & 1 deletion schema_validation/validate_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
// ValidateOpenAPIDocument will validate an OpenAPI document against the OpenAPI 2, 3.0 and 3.1 schemas (depending on version)
// It will return true if the document is valid, false if it is not and a slice of ValidationError pointers.
func ValidateOpenAPIDocument(doc libopenapi.Document, opts ...config.Option) (bool, []*liberrors.ValidationError) {

options := config.NewValidationOptions(opts...)

info := doc.GetSpecInfo()
Expand Down
2 changes: 0 additions & 2 deletions schema_validation/validate_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ type schemaValidator struct {

// NewSchemaValidatorWithLogger will create a new SchemaValidator instance, ready to accept schemas and payloads to validate.
func NewSchemaValidatorWithLogger(logger *slog.Logger, opts ...config.Option) SchemaValidator {

options := config.NewValidationOptions(opts...)

return &schemaValidator{options: options, logger: logger, lock: sync.Mutex{}}

}

// NewSchemaValidator will create a new SchemaValidator instance, ready to accept schemas and payloads to validate.
Expand Down
1 change: 0 additions & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func NewValidator(document libopenapi.Document, opts ...config.Option) (Validato

// NewValidatorFromV3Model will create a new Validator from an OpenAPI Model
func NewValidatorFromV3Model(m *v3.Document, opts ...config.Option) Validator {

options := config.NewValidationOptions(opts...)

v := &validator{options: options, v3Model: m}
Expand Down
1 change: 0 additions & 1 deletion validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ func fakeRegexEngine(s string) (jsonschema.Regexp, error) {
}

func TestNewValidator_WithRegex(t *testing.T) {

doc, err := libopenapi.NewDocument(petstoreBytes)
require.Nil(t, err, "Failed to load spec")

Expand Down

0 comments on commit 8b9e667

Please sign in to comment.