forked from loafle/openapi-generator-original
adds support for x-pattern-message in kotlin-spring generator (#19134)
* adds support for x-pattern-message for patterns in kotlin-spring generator as known in java spring generator * updates doc kotlin-spring
This commit is contained in:
parent
47abf82164
commit
ebf72a3772
@ -57,6 +57,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|Whether to use tags for creating interface and controller class names| |false|
|
||||
|
||||
## SUPPORTED VENDOR EXTENSIONS
|
||||
|
||||
| Extension name | Description | Applicable for | Default value |
|
||||
| -------------- | ----------- | -------------- | ------------- |
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
|
@ -32,6 +32,7 @@ import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.VendorExtension;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.DocumentationProviderFeatures;
|
||||
import org.openapitools.codegen.languages.features.SwaggerUIFeatures;
|
||||
@ -982,4 +983,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.requestMappingMode = requestMappingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VendorExtension> getSupportedVendorExtensions() {
|
||||
List<VendorExtension> extensions = super.getSupportedVendorExtensions();
|
||||
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
|
||||
return extensions;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ format: email
|
||||
@get:Email{{/isEmail}}{{!
|
||||
pattern set
|
||||
}}{{#pattern}}
|
||||
@get:Pattern(regexp="{{{.}}}"){{/pattern}}{{!
|
||||
@get:Pattern(regexp="{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}){{/pattern}}{{!
|
||||
minLength && maxLength set
|
||||
}}{{#minLength}}{{#maxLength}}
|
||||
@get:Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
|
||||
|
Loading…
x
Reference in New Issue
Block a user