Skip to content

Commit 7859478

Browse files
JemDaydaveshanley
authored andcommitted
Fixed linting errors.
1 parent 57eb3c8 commit 7859478

File tree

10 files changed

+1
-15
lines changed

10 files changed

+1
-15
lines changed

config/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ type Option func(*ValidationOptions)
1414

1515
// NewValidationOptions creates a new ValidationOptions instance with default values.
1616
func NewValidationOptions(opts ...Option) *ValidationOptions {
17-
1817
// Create the set of default values
1918
o := &ValidationOptions{}
2019

parameters/parameters.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ type ParameterValidator interface {
6868

6969
// NewParameterValidator will create a new ParameterValidator from an OpenAPI 3+ document
7070
func NewParameterValidator(document *v3.Document, opts ...config.Option) ParameterValidator {
71-
7271
options := config.NewValidationOptions(opts...)
7372

7473
return &paramValidator{options: options, document: document}
75-
7674
}
7775

7876
type paramValidator struct {

requests/request_body.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ type RequestBodyValidator interface {
3232

3333
// NewRequestBodyValidator will create a new RequestBodyValidator from an OpenAPI 3+ document
3434
func NewRequestBodyValidator(document *v3.Document, opts ...config.Option) RequestBodyValidator {
35-
3635
options := config.NewValidationOptions(opts...)
3736

3837
return &requestBodyValidator{options: options, document: document, schemaCache: &sync.Map{}}
39-
4038
}
4139

4240
type schemaCache struct {

requests/validate_request.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ func ValidateRequestSchema(
3737
jsonSchema []byte,
3838
opts ...config.Option,
3939
) (bool, []*errors.ValidationError) {
40-
41-
options := config.NewValidationOptions()
40+
options := config.NewValidationOptions(opts...)
4241

4342
var validationErrors []*errors.ValidationError
4443

responses/response_body.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ type ResponseBodyValidator interface {
3333

3434
// NewResponseBodyValidator will create a new ResponseBodyValidator from an OpenAPI 3+ document
3535
func NewResponseBodyValidator(document *v3.Document, opts ...config.Option) ResponseBodyValidator {
36-
3736
options := config.NewValidationOptions(opts...)
3837

3938
return &responseBodyValidator{options: options, document: document, schemaCache: &sync.Map{}}
40-
4139
}
4240

4341
type schemaCache struct {

responses/validate_response.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func ValidateResponseSchema(
4141
jsonSchema []byte,
4242
opts ...config.Option,
4343
) (bool, []*errors.ValidationError) {
44-
4544
options := config.NewValidationOptions(opts...)
4645

4746
var validationErrors []*errors.ValidationError

schema_validation/validate_document.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
// ValidateOpenAPIDocument will validate an OpenAPI document against the OpenAPI 2, 3.0 and 3.1 schemas (depending on version)
2323
// It will return true if the document is valid, false if it is not and a slice of ValidationError pointers.
2424
func ValidateOpenAPIDocument(doc libopenapi.Document, opts ...config.Option) (bool, []*liberrors.ValidationError) {
25-
2625
options := config.NewValidationOptions(opts...)
2726

2827
info := doc.GetSpecInfo()

schema_validation/validate_schema.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ type schemaValidator struct {
5858

5959
// NewSchemaValidatorWithLogger will create a new SchemaValidator instance, ready to accept schemas and payloads to validate.
6060
func NewSchemaValidatorWithLogger(logger *slog.Logger, opts ...config.Option) SchemaValidator {
61-
6261
options := config.NewValidationOptions(opts...)
6362

6463
return &schemaValidator{options: options, logger: logger, lock: sync.Mutex{}}
65-
6664
}
6765

6866
// NewSchemaValidator will create a new SchemaValidator instance, ready to accept schemas and payloads to validate.

validator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func NewValidator(document libopenapi.Document, opts ...config.Option) (Validato
7676

7777
// NewValidatorFromV3Model will create a new Validator from an OpenAPI Model
7878
func NewValidatorFromV3Model(m *v3.Document, opts ...config.Option) Validator {
79-
8079
options := config.NewValidationOptions(opts...)
8180

8281
v := &validator{options: options, v3Model: m}

validator_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func fakeRegexEngine(s string) (jsonschema.Regexp, error) {
153153
}
154154

155155
func TestNewValidator_WithRegex(t *testing.T) {
156-
157156
doc, err := libopenapi.NewDocument(petstoreBytes)
158157
require.Nil(t, err, "Failed to load spec")
159158

0 commit comments

Comments
 (0)