diff --git a/config/config.go b/config/config.go index 5ba7362..7d395c9 100644 --- a/config/config.go +++ b/config/config.go @@ -1,8 +1,9 @@ package config import ( - "github.com/pb33f/libopenapi-validator/cache" "github.com/santhosh-tekuri/jsonschema/v6" + + "github.com/pb33f/libopenapi-validator/cache" ) // RegexCache can be set to enable compiled regex caching. diff --git a/parameters/header_parameters.go b/parameters/header_parameters.go index a4c56a1..fed3fc8 100644 --- a/parameters/header_parameters.go +++ b/parameters/header_parameters.go @@ -9,11 +9,10 @@ import ( "strconv" "strings" - lowbase "github.com/pb33f/libopenapi/datamodel/low/base" - "github.com/pb33f/libopenapi/datamodel/high/base" v3 "github.com/pb33f/libopenapi/datamodel/high/v3" + lowbase "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/pb33f/libopenapi-validator/errors" "github.com/pb33f/libopenapi-validator/helpers" diff --git a/parameters/validate_parameter_test.go b/parameters/validate_parameter_test.go index 42181d0..ba31573 100644 --- a/parameters/validate_parameter_test.go +++ b/parameters/validate_parameter_test.go @@ -5,14 +5,14 @@ import ( "sync" "testing" - "github.com/pb33f/libopenapi-validator/config" - "github.com/pb33f/libopenapi-validator/helpers" - lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3" - "github.com/pb33f/libopenapi" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" + + lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3" + + "github.com/pb33f/libopenapi-validator/config" + "github.com/pb33f/libopenapi-validator/helpers" ) func Test_ForceCompilerError(t *testing.T) { diff --git a/requests/validate_body_test.go b/requests/validate_body_test.go index 6deaaf4..a74b6ae 100644 --- a/requests/validate_body_test.go +++ b/requests/validate_body_test.go @@ -12,10 +12,11 @@ import ( "testing" "github.com/pb33f/libopenapi" - "github.com/pb33f/libopenapi-validator/config" - "github.com/pb33f/libopenapi-validator/paths" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/pb33f/libopenapi-validator/config" + "github.com/pb33f/libopenapi-validator/paths" ) func TestValidateBody_NotRequiredBody(t *testing.T) { diff --git a/requests/validate_request.go b/requests/validate_request.go index 8ec74e1..03cc20e 100644 --- a/requests/validate_request.go +++ b/requests/validate_request.go @@ -13,17 +13,18 @@ import ( "regexp" "strconv" - "github.com/pb33f/libopenapi-validator/cache" - "github.com/pb33f/libopenapi-validator/config" - "github.com/pb33f/libopenapi-validator/errors" - "github.com/pb33f/libopenapi-validator/helpers" - "github.com/pb33f/libopenapi-validator/schema_validation" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/pb33f/libopenapi/utils" "github.com/santhosh-tekuri/jsonschema/v6" "go.yaml.in/yaml/v4" "golang.org/x/text/language" "golang.org/x/text/message" + + "github.com/pb33f/libopenapi-validator/cache" + "github.com/pb33f/libopenapi-validator/config" + "github.com/pb33f/libopenapi-validator/errors" + "github.com/pb33f/libopenapi-validator/helpers" + "github.com/pb33f/libopenapi-validator/schema_validation" ) var instanceLocationRegex = regexp.MustCompile(`^/(\d+)`) diff --git a/requests/validate_request_test.go b/requests/validate_request_test.go index 9d64e43..de66448 100644 --- a/requests/validate_request_test.go +++ b/requests/validate_request_test.go @@ -9,10 +9,11 @@ import ( "testing" "github.com/pb33f/libopenapi" - "github.com/pb33f/libopenapi-validator/config" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/pb33f/libopenapi-validator/config" ) func TestValidateRequestSchema(t *testing.T) { diff --git a/responses/validate_headers.go b/responses/validate_headers.go index ee284fa..5eb22df 100644 --- a/responses/validate_headers.go +++ b/responses/validate_headers.go @@ -8,14 +8,15 @@ import ( "net/http" "strings" - "github.com/pb33f/libopenapi-validator/helpers" - "github.com/pb33f/libopenapi-validator/parameters" + "github.com/pb33f/libopenapi/orderedmap" + v3 "github.com/pb33f/libopenapi/datamodel/high/v3" lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3" - "github.com/pb33f/libopenapi/orderedmap" "github.com/pb33f/libopenapi-validator/config" "github.com/pb33f/libopenapi-validator/errors" + "github.com/pb33f/libopenapi-validator/helpers" + "github.com/pb33f/libopenapi-validator/parameters" ) // ValidateResponseHeaders validates the response headers against the OpenAPI spec. diff --git a/responses/validate_response.go b/responses/validate_response.go index 91f64fb..ab6c4af 100644 --- a/responses/validate_response.go +++ b/responses/validate_response.go @@ -13,17 +13,18 @@ import ( "regexp" "strconv" - "github.com/pb33f/libopenapi-validator/cache" - "github.com/pb33f/libopenapi-validator/config" - "github.com/pb33f/libopenapi-validator/errors" - "github.com/pb33f/libopenapi-validator/helpers" - "github.com/pb33f/libopenapi-validator/schema_validation" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/pb33f/libopenapi/utils" "github.com/santhosh-tekuri/jsonschema/v6" "go.yaml.in/yaml/v4" "golang.org/x/text/language" "golang.org/x/text/message" + + "github.com/pb33f/libopenapi-validator/cache" + "github.com/pb33f/libopenapi-validator/config" + "github.com/pb33f/libopenapi-validator/errors" + "github.com/pb33f/libopenapi-validator/helpers" + "github.com/pb33f/libopenapi-validator/schema_validation" ) var instanceLocationRegex = regexp.MustCompile(`^/(\d+)`) diff --git a/responses/validate_response_test.go b/responses/validate_response_test.go index 3520c8b..7fe5e45 100644 --- a/responses/validate_response_test.go +++ b/responses/validate_response_test.go @@ -9,10 +9,11 @@ import ( "testing" "github.com/pb33f/libopenapi" - "github.com/pb33f/libopenapi-validator/config" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/pb33f/libopenapi-validator/config" ) func TestValidateResponseSchema(t *testing.T) { diff --git a/schema_validation/property_locator.go b/schema_validation/property_locator.go index 6d91a37..14bfe56 100644 --- a/schema_validation/property_locator.go +++ b/schema_validation/property_locator.go @@ -7,10 +7,11 @@ import ( "regexp" "strings" - liberrors "github.com/pb33f/libopenapi-validator/errors" - "github.com/pb33f/libopenapi-validator/helpers" "github.com/santhosh-tekuri/jsonschema/v6" "go.yaml.in/yaml/v4" + + liberrors "github.com/pb33f/libopenapi-validator/errors" + "github.com/pb33f/libopenapi-validator/helpers" ) // PropertyNameInfo contains extracted information about a property name validation error diff --git a/schema_validation/validate_schema.go b/schema_validation/validate_schema.go index 91860c4..9f2b139 100644 --- a/schema_validation/validate_schema.go +++ b/schema_validation/validate_schema.go @@ -29,7 +29,7 @@ import ( ) // SchemaValidator is an interface that defines the methods for validating a *base.Schema (V3+ Only) object. -// There are 8 methods for validating a schema: +// There are 6 methods for validating a schema: // // ValidateSchemaString accepts a schema object to validate against, and a JSON/YAML blob that is defined as a string. // ValidateSchemaObject accepts a schema object to validate against, and an object, created from unmarshalled JSON/YAML. @@ -37,8 +37,6 @@ import ( // ValidateSchemaStringWithVersion - version-aware validation that allows OpenAPI 3.0 keywords when version is specified. // ValidateSchemaObjectWithVersion - version-aware validation that allows OpenAPI 3.0 keywords when version is specified. // ValidateSchemaBytesWithVersion - version-aware validation that allows OpenAPI 3.0 keywords when version is specified. -// ValidateXMLString - validates XML string against schema, applying OpenAPI xml object transformations. -// ValidateXMLStringWithVersion - version-aware XML validation. type SchemaValidator interface { // ValidateSchemaString accepts a schema object to validate against, and a JSON/YAML blob that is defined as a string. // Uses OpenAPI 3.1+ validation by default (strict JSON Schema compliance). @@ -67,14 +65,6 @@ type SchemaValidator interface { // When version is 3.0, OpenAPI 3.0-specific keywords like 'nullable' are allowed and processed. // When version is 3.1+, OpenAPI 3.0-specific keywords like 'nullable' will cause validation to fail. ValidateSchemaBytesWithVersion(schema *base.Schema, payload []byte, version float32) (bool, []*liberrors.ValidationError) - - // ValidateXMLString validates an XML string against an OpenAPI schema, applying xml object transformations. - // Uses OpenAPI 3.1+ validation by default. - ValidateXMLString(schema *base.Schema, xmlString string) (bool, []*liberrors.ValidationError) - - // ValidateXMLStringWithVersion validates an XML string with version-specific rules. - // When version is 3.0, OpenAPI 3.0-specific keywords like 'nullable' are allowed. - ValidateXMLStringWithVersion(schema *base.Schema, xmlString string, version float32) (bool, []*liberrors.ValidationError) } var instanceLocationRegex = regexp.MustCompile(`^/(\d+)`) diff --git a/schema_validation/validate_schema_coercion_test.go b/schema_validation/validate_schema_coercion_test.go index a237bae..a8036dc 100644 --- a/schema_validation/validate_schema_coercion_test.go +++ b/schema_validation/validate_schema_coercion_test.go @@ -8,8 +8,9 @@ import ( "testing" "github.com/pb33f/libopenapi" - "github.com/pb33f/libopenapi-validator/config" "github.com/stretchr/testify/assert" + + "github.com/pb33f/libopenapi-validator/config" ) func TestSchemaValidator_ScalarCoercion_Boolean(t *testing.T) { diff --git a/schema_validation/validate_schema_openapi_test.go b/schema_validation/validate_schema_openapi_test.go index 7ab3d32..fb3f14f 100644 --- a/schema_validation/validate_schema_openapi_test.go +++ b/schema_validation/validate_schema_openapi_test.go @@ -8,8 +8,9 @@ import ( "testing" "github.com/pb33f/libopenapi" - "github.com/pb33f/libopenapi-validator/config" "github.com/stretchr/testify/assert" + + "github.com/pb33f/libopenapi-validator/config" ) func TestSchemaValidator_NullableKeyword_OpenAPI30_Success(t *testing.T) { diff --git a/schema_validation/validate_xml.go b/schema_validation/validate_xml.go index b65304b..ad30bd8 100644 --- a/schema_validation/validate_xml.go +++ b/schema_validation/validate_xml.go @@ -9,27 +9,15 @@ import ( "log/slog" "strings" - xj "github.com/basgys/goxml2json" "github.com/pb33f/libopenapi/datamodel/high/base" + xj "github.com/basgys/goxml2json" + liberrors "github.com/pb33f/libopenapi-validator/errors" "github.com/pb33f/libopenapi-validator/helpers" ) -// ValidateXMLString validates an XML string against an OpenAPI schema, -// applying xml object transformations before validation. -// uses openapi 3.1+ validation by default. -func (s *schemaValidator) ValidateXMLString(schema *base.Schema, xmlString string) (bool, []*liberrors.ValidationError) { - return s.validateXMLWithVersion(schema, xmlString, s.logger, 3.1) -} - -// ValidateXMLStringWithVersion validates an XML string with version-specific rules. -// when version is 3.0, openapi 3.0-specific keywords like 'nullable' are allowed. -func (s *schemaValidator) ValidateXMLStringWithVersion(schema *base.Schema, xmlString string, version float32) (bool, []*liberrors.ValidationError) { - return s.validateXMLWithVersion(schema, xmlString, s.logger, version) -} - -func (s *schemaValidator) validateXMLWithVersion(schema *base.Schema, xmlString string, log *slog.Logger, version float32) (bool, []*liberrors.ValidationError) { +func (x *xmlValidator) validateXMLWithVersion(schema *base.Schema, xmlString string, log *slog.Logger, version float32) (bool, []*liberrors.ValidationError) { var validationErrors []*liberrors.ValidationError if schema == nil { @@ -58,7 +46,7 @@ func (s *schemaValidator) validateXMLWithVersion(schema *base.Schema, xmlString } // validate transformed json against schema using existing validator - return s.validateSchemaWithVersion(schema, nil, transformedJSON, log, version) + return x.schemaValidator.validateSchemaWithVersion(schema, nil, transformedJSON, log, version) } // transformXMLToSchemaJSON converts xml to json structure matching openapi schema. diff --git a/schema_validation/validate_xml_test.go b/schema_validation/validate_xml_test.go index 9f12d04..1d3faad 100644 --- a/schema_validation/validate_xml_test.go +++ b/schema_validation/validate_xml_test.go @@ -42,7 +42,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/pet").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() valid, validationErrors := validator.ValidateXMLString(schema, "true") assert.True(t, valid) @@ -72,7 +72,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/pet").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // empty xml should fail valid, validationErrors := validator.ValidateXMLString(schema, "") @@ -112,7 +112,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/pet").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() valid, validationErrors := validator.ValidateXMLString(schema, `Fluffy`) assert.True(t, valid) @@ -145,7 +145,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/pet").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid integer valid, validationErrors := validator.ValidateXMLString(schema, "5") @@ -195,7 +195,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/pets").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid wrapped array validXML := `Fluffy3Spot5` @@ -246,7 +246,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/user").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid xml with custom element names validXML := `42johndoejohn@example.com` @@ -293,7 +293,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/book").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid xml with both attributes and elements validXML := `Go ProgrammingJohn Doe29.99` @@ -340,7 +340,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/order").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid nested xml validXML := `123Jane Doe
123 Main StSpringfield
` @@ -381,7 +381,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/data").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // goxml2json should coerce numeric strings to numbers validXML := `423.14hellotrue` @@ -423,7 +423,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/product").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // missing required property 'name' invalidXML := `123` @@ -481,7 +481,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/api").Post.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/soap+xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid soap-like xml validXML := `success1699372800result` @@ -516,7 +516,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/test").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid xml with whitespace validXML := ` @@ -561,7 +561,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/message").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid xml with namespace (goxml2json strips namespace prefixes) validXML := `HelloWorld` @@ -601,7 +601,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/config").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // xml has wrong element names (should be 'enabled' and 'maxRetries') // this should fail because required properties are missing @@ -645,7 +645,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/item").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid - attributes are integers validXML := `Widget` @@ -690,7 +690,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/measurement").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // valid xml with float values validXML := `23.45665.21013.25` @@ -732,7 +732,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/item").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // test with version 3.0 - should allow nullable keyword valid, validationErrors := validator.ValidateXMLStringWithVersion(schema, "test", 3.0) @@ -741,7 +741,7 @@ paths: } func TestValidateXML_NilSchema(t *testing.T) { - validator := NewSchemaValidator() + validator := NewXMLValidator() // test with nil schema - should return false with empty errors valid, validationErrors := validator.ValidateXMLString(nil, "value") @@ -798,7 +798,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/empty").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // schema with no properties should still validate valid, validationErrors := validator.ValidateXMLString(schema, "value") @@ -829,7 +829,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/simple").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // primitive value (non-object) should work valid, validationErrors := validator.ValidateXMLString(schema, "hello world") @@ -865,7 +865,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/items").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // array without wrapped - items are direct siblings validXML := `onetwothree` @@ -909,7 +909,7 @@ paths: schema := v3Doc.Model.Paths.PathItems.GetOrZero("/collection").Get.Responses.Codes.GetOrZero("200"). Content.GetOrZero("application/xml").Schema.Schema() - validator := NewSchemaValidator() + validator := NewXMLValidator() // wrapper contains items with wrong name (item instead of record) // this tests the fallback path where unwrapped element is not found diff --git a/schema_validation/xml_validator.go b/schema_validation/xml_validator.go new file mode 100644 index 0000000..f9b2ef6 --- /dev/null +++ b/schema_validation/xml_validator.go @@ -0,0 +1,59 @@ +// Copyright 2023 Princess B33f Heavy Industries / Dave Shanley +// SPDX-License-Identifier: MIT + +package schema_validation + +import ( + "log/slog" + "os" + + "github.com/pb33f/libopenapi/datamodel/high/base" + + "github.com/pb33f/libopenapi-validator/config" + liberrors "github.com/pb33f/libopenapi-validator/errors" +) + +// XMLValidator is an interface that defines methods for validating XML against OpenAPI schemas. +// There are 2 methods for validating XML: +// +// ValidateXMLString validates an XML string against a schema, applying OpenAPI xml object transformations. +// ValidateXMLStringWithVersion - version-aware XML validation that allows OpenAPI 3.0 keywords when version is specified. +type XMLValidator interface { + // ValidateXMLString validates an XML string against an OpenAPI schema, applying xml object transformations. + // Uses OpenAPI 3.1+ validation by default (strict JSON Schema compliance). + ValidateXMLString(schema *base.Schema, xmlString string) (bool, []*liberrors.ValidationError) + + // ValidateXMLStringWithVersion validates an XML string with version-specific rules. + // When version is 3.0, OpenAPI 3.0-specific keywords like 'nullable' are allowed and processed. + // When version is 3.1+, OpenAPI 3.0-specific keywords like 'nullable' will cause validation to fail. + ValidateXMLStringWithVersion(schema *base.Schema, xmlString string, version float32) (bool, []*liberrors.ValidationError) +} + +type xmlValidator struct { + schemaValidator *schemaValidator + logger *slog.Logger +} + +// NewXMLValidatorWithLogger creates a new XMLValidator instance with a custom logger. +func NewXMLValidatorWithLogger(logger *slog.Logger, opts ...config.Option) XMLValidator { + options := config.NewValidationOptions(opts...) + // Create an internal schema validator for JSON validation after XML transformation + sv := &schemaValidator{options: options, logger: logger} + return &xmlValidator{schemaValidator: sv, logger: logger} +} + +// NewXMLValidator creates a new XMLValidator instance with default logging configuration. +func NewXMLValidator(opts ...config.Option) XMLValidator { + logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{ + Level: slog.LevelError, + })) + return NewXMLValidatorWithLogger(logger, opts...) +} + +func (x *xmlValidator) ValidateXMLString(schema *base.Schema, xmlString string) (bool, []*liberrors.ValidationError) { + return x.validateXMLWithVersion(schema, xmlString, x.logger, 3.1) +} + +func (x *xmlValidator) ValidateXMLStringWithVersion(schema *base.Schema, xmlString string, version float32) (bool, []*liberrors.ValidationError) { + return x.validateXMLWithVersion(schema, xmlString, x.logger, version) +} diff --git a/validator.go b/validator.go index bcfdf51..4d9660c 100644 --- a/validator.go +++ b/validator.go @@ -10,9 +10,10 @@ import ( "github.com/pb33f/libopenapi" "github.com/pb33f/libopenapi/datamodel/high/base" - v3 "github.com/pb33f/libopenapi/datamodel/high/v3" "github.com/pb33f/libopenapi/utils" + v3 "github.com/pb33f/libopenapi/datamodel/high/v3" + "github.com/pb33f/libopenapi-validator/cache" "github.com/pb33f/libopenapi-validator/config" "github.com/pb33f/libopenapi-validator/errors" diff --git a/validator_test.go b/validator_test.go index 08b22f4..3244ed7 100644 --- a/validator_test.go +++ b/validator_test.go @@ -17,8 +17,6 @@ import ( "testing" "unicode" - "github.com/pb33f/libopenapi-validator/cache" - "github.com/dlclark/regexp2" "github.com/pb33f/libopenapi" "github.com/santhosh-tekuri/jsonschema/v6" @@ -27,6 +25,7 @@ import ( v3 "github.com/pb33f/libopenapi/datamodel/high/v3" + "github.com/pb33f/libopenapi-validator/cache" "github.com/pb33f/libopenapi-validator/config" "github.com/pb33f/libopenapi-validator/helpers" )