@@ -12,6 +12,7 @@ import (
1212 "strings"
1313 "sync"
1414
15+ "github.com/pb33f/libopenapi-validator/config"
1516 libopenapierrs "github.com/pb33f/libopenapi-validator/errors"
1617 "github.com/pb33f/libopenapi-validator/helpers"
1718 "github.com/pb33f/libopenapi-validator/paths"
@@ -26,7 +27,7 @@ type ResponseMockEngine struct {
2627 validator validation.HttpValidator
2728 mockEngine * renderer.MockGenerator
2829 pretty bool
29- regexCache * sync. Map
30+ validationOpts * config. ValidationOptions
3031 hardValidation bool // when true, reject requests with validation errors
3132}
3233
@@ -45,7 +46,7 @@ func NewMockEngine(document *v3.Document, pretty, useAllPropertyExamples bool) *
4546 validator : validation .NewHttpValidator (document ),
4647 mockEngine : me ,
4748 pretty : pretty ,
48- regexCache : & sync.Map {},
49+ validationOpts : config . NewValidationOptions ( config . WithRegexCache ( & sync.Map {})) ,
4950 hardValidation : true , // default to rejecting on validation errors for backward compatibility
5051 }
5152}
@@ -67,7 +68,7 @@ func NewStrictMockEngine(document *v3.Document, pretty, useAllPropertyExamples b
6768 validator : validation .NewStrictHttpValidator (document ),
6869 mockEngine : me ,
6970 pretty : pretty ,
70- regexCache : & sync.Map {},
71+ validationOpts : config . NewValidationOptions ( config . WithRegexCache ( & sync.Map {})) ,
7172 hardValidation : true , // default to rejecting on validation errors for backward compatibility
7273 }
7374}
@@ -218,7 +219,7 @@ func (rme *ResponseMockEngine) extractMediaTypeHeader(request *http.Request) str
218219}
219220
220221func (rme * ResponseMockEngine ) findPath (request * http.Request ) (* v3.PathItem , error ) {
221- path , errs , _ := paths .FindPath (request , rme .doc , rme .regexCache )
222+ path , errs , _ := paths .FindPath (request , rme .doc , rme .validationOpts )
222223 return path , rme .packErrors (errs )
223224}
224225
0 commit comments