Skip to content

IntelliJ IDEA plugin for an enhanced coding experience on JCV based projects.

License

Notifications You must be signed in to change notification settings

ekino/jcv-idea-plugin

Repository files navigation

JCV plugin

IntelliJ IDEA plugin for an enhanced coding experience on JCV based projects.

Release License Jetbrains plugin Downloads

This plugin brings the JCV language support injected in JSON language.

Auto-completion and documentation

Any identified validator will get a quick documentation and even external links to official documentation for official JCV validators:

Validator documentation screenshot

As you start typing in the JCV template pattern, a list of available validators will be suggested to you:

Completion list screenshot

You will also get parameter values completion if available, for example with the date_time_format from JCV:

Auto completion screencast

Supported validators

Official ones

JCV is a library allowing you to compare JSON contents with embedded validation. It comes with plenty of pre-defined validators (listed here) designed to cover the most common needs when validating data with non-predictable values.

JCV-DB reuses these validators and also defines a list of its own (listed here) that are specific to a database-oriented usage.

This plugin offers autocompletion on all the validators of these two projects to date if detected in your project external libraries.

Using an official validator without the actual library linked to the current project module will give you a warning and can guide you to the Maven Central library page to get it:

Missing library screencast

Your custom ones

You can define your own custom validator definitions by adding a .jcvdefinitions.json file in the project root directory or just let the plugin do it for you:

Custom validator definition screencast

Here is an example definition you can customize:

ROOT_PROJECT_DIRECTORY/.jcvdefinitions.json

{
  "validators" : [ {
    "id" : "my_custom_validator",
    "parameters" : [ {
      "description" : "My first param",
      "required" : true,
      "suggested_values" : [ "Value 1", "Value 2" ]
    }, {
      "description" : "Another parameter",
      "required" : false,
      "suggested_values" : [ "Another value to suggest" ]
    } ]
  } ]
}

Replacements suggestions

The plugin can find raw JSON value that can be replaced by official matching validators.

Replacement suggestions screenshot

Note that it also supports multi-caret replacement with matching validators for all JSON values find at each caret.

Replacement suggestions screencast

Settings

Color scheme

You can configure the color scheme settings:

Color scheme settings screenshot

Inspections

Here are the available inspections that you can customize:

Inspections screenshot

Intentions

You can find the JCV replacement suggestions on JSON values in the intentions:

Intentions screenshot