@@ -33,6 +33,7 @@ type opts struct {
3333 requiresCtlrUnpubVolSecrets bool
3434 requiresNodeStgVolSecrets bool
3535 requiresNodePubVolSecrets bool
36+ disableFieldLenCheck bool
3637}
3738
3839// WithRequestValidation is a Option that enables request validation.
@@ -131,6 +132,14 @@ func WithRequiresNodePublishVolumeSecrets() Option {
131132 }
132133}
133134
135+ // WithDisableFieldLenCheck is a Option
136+ // that indicates that the length of fields should not be validated
137+ func WithDisableFieldLenCheck () Option {
138+ return func (o * opts ) {
139+ o .disableFieldLenCheck = true
140+ }
141+ }
142+
134143type interceptor struct {
135144 opts opts
136145}
@@ -276,8 +285,10 @@ func (s *interceptor) validateRequest(
276285 }
277286
278287 // Validate field sizes.
279- if err := validateFieldSizes (req ); err != nil {
280- return err
288+ if ! s .opts .disableFieldLenCheck {
289+ if err := validateFieldSizes (req ); err != nil {
290+ return err
291+ }
281292 }
282293
283294 // Check to see if the request has a volume ID and if it is set.
@@ -359,8 +370,10 @@ func (s *interceptor) validateResponse(
359370 }
360371
361372 // Validate the field sizes.
362- if err := validateFieldSizes (rep ); err != nil {
363- return err
373+ if ! s .opts .disableFieldLenCheck {
374+ if err := validateFieldSizes (rep ); err != nil {
375+ return err
376+ }
364377 }
365378
366379 switch tobj := rep .(type ) {
0 commit comments