YApi Settings
IDE Settings
Configure YApi settings in the IDE:
Settings > Other Settings > EasyApi > YApi
| Setting | Description |
|---|---|
| Yapi Server | YApi server address |
| Tokens | Project tokens in module=token format (one per line) |
| Export Mode | How to handle existing APIs on export (see below) |
| Request body JSON5 | Use JSON5 format for request body (default: off) |
| Response body JSON5 | Use JSON5 format for response body (default: off) |
Additional options in the General tab:
| Setting | Default | Description |
|---|---|---|
| Enable URL Templating | true | Enable URL templating for path parameters |
| Switch Notice | true | Show notification when switching YApi project |
Getting a YApi Token
- Log in to YApi
- Go to project settings
- Copy the project Token
No need to fill tokens manually
You do not have to enter tokens (or the server address) in Settings before exporting. When you export APIs, the plugin automatically pops up a dialog prompting for the YApi server URL and the project token for the target module. Enter them there and the plugin saves them for next time.
The Tokens field above is just a convenience for pre-filling tokens for multiple modules at once; it is optional.
Token Format
Tokens are specified as module=token pairs, one per line in the IDE Tokens field. The module name is used to match APIs to the correct YApi project.
Export Mode
| Mode | Description |
|---|---|
| ALWAYS_UPDATE | Always update existing APIs (default) |
| NEVER_UPDATE | Never update existing APIs |
| ALWAYS_ASK | Show a dialog to ask whether to override each API |
| UPDATE_IF_CHANGED | Update only when the API content has changed |
Config File Rules
The following rules can be set in config files (.easy.api.config):
| Rule | Description |
|---|---|
| yapi.project | Set the YApi project for API grouping |
| yapi.export.before | Event before YApi export |
| yapi.save.before | Event before saving to YApi |
| yapi.save.after | Event after saving to YApi |
YApi Mock
EasyYapi supports syncing field mock rules to the YApi Mock service.
See YApi Mock for details.