Local File Config
You can create a local configuration file to customize EasyApi behavior for your project.
Creating a Config File
Create a file named .easy.api.config in your project root directory. EasyApi will automatically load this file.
You can also use YAML format with the following file names:
.easy.api.config— Properties format (default).easy.api.yml— YAML format.easy.api.yaml— YAML format
Config File Location
EasyApi searches for configuration files in the following order:
.easy.api.config/.easy.api.yml/.easy.api.yamlin the module directory.easy.api.config/.easy.api.yml/.easy.api.yamlin the project root directory- IDE settings (Preferences > Other Settings > EasyApi)
- Built-in recommended configuration
Config File Format
The configuration file uses a simple key-value format:
properties
# This is a comment
# Import additional properties
properties.additional=${module_path}/src/main/resources/application.properties
# Set API name
api.name=#regex:^(.+)Controller$=$1
# Set class prefix path
class.prefix.path=${server.servlet.context-path}
# Ignore specific fields
field.ignore=groovy:it.name() == "password"
# Set field default value
field.default.value=groovy:it.hasAnn("javax.validation.constraints.NotNull") ? "required" : nullYAML Format
When using .easy.api.yml or .easy.api.yaml, the configuration uses YAML format:
yaml
# Set API name
api:
name: "#regex:^(.+)Controller$=$1"
# Set class prefix path
class:
prefix:
path: "${server.servlet.context-path}"
# Ignore specific fields
field:
ignore: "groovy:it.name() == 'password'"
# Set field default value
field:
default:
value: "groovy:it.hasAnn('javax.validation.constraints.NotNull') ? 'required' : null"
# Type conversions
json:
rule:
convert:
"#regex:org.springframework.http.ResponseEntity<(.*?)>": "${1}"Property Resolution
You can reference Spring properties in your configuration:
properties
# Resolve spring properties
###set ignoreUnresolved = true
class.prefix.path=${server.servlet.context-path}
###set ignoreUnresolved = falseThe ###set ignoreUnresolved = true directive tells EasyApi to not throw an error if the property cannot be resolved.
Adding Config Sources
You can add additional configuration sources:
properties
# Add local property files
properties.additional=${module_path}/src/main/resources/application.properties
properties.additional=${module_path}/src/main/resources/application.yml
# Add remote config files
properties.additional=https://raw.githubusercontent.com/your-org/configs/main/easyapi.config