Browse Source

dynamite: Fix patterns

pull/249/head
jld3103 2 years ago
parent
commit
37a4a887c3
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/dynamite/lib/src/openapi_builder.dart

2
packages/dynamite/lib/src/openapi_builder.dart

@ -725,7 +725,7 @@ class OpenAPIBuilder implements Builder {
if (parameter.schema?.pattern != null) { if (parameter.schema?.pattern != null) {
code.write(''' code.write('''
if (!RegExp(r'${parameter.schema!.pattern!}').hasMatch(${_toDartName(parameter.name)})) { if (!RegExp(r'${parameter.schema!.pattern!}').hasMatch(${_toDartName(parameter.name)})) {
throw Exception('Invalid value "\$${_toDartName(parameter.name)}" for parameter "${_toDartName(parameter.name)}" with pattern "' r'${parameter.schema!.pattern!}"'); // coverage:ignore-line throw Exception('Invalid value "\$${_toDartName(parameter.name)}" for parameter "${_toDartName(parameter.name)}" with pattern "\${r'${parameter.schema!.pattern!}'}"'); // coverage:ignore-line
} }
'''); ''');
} }

Loading…
Cancel
Save