Gradle plugin to check, if rest-controllers are used by clients and clients have suitable rest-interfaces

Overview

Verify-Feign Gradle Plugin

This plugin will help you to verify all rest-clients and -controllers in a multimodule spring project. It will check, if all feign clients have matching controllers with the fitting parameters and if all rest-interfaces are used by a client, are public endpoints or are frontend-endpoints.

This plugin currently only supports OpenFeign-clients and Spring-Boot-controllers

Quickstart

ToDo add Quickstart guide

Implementation

You are provided with 3 annotations

@VerifyFeign @PublicEndpoint @FrontendEndpoint

With these you can mark, how to analyse the controllers and clients.

The first one marks a Feign-client and needs to be in front of an interface, which implements client-requests. The annotation has a parameter, which describes the target-module, where the matching rest-controller is implemented.

If an interface is marked with @VerifyFeign, all @RequestLines will be checked for a matching rest-controllers.

The rest-controllers need to be implemented in a class annotated with @RestController. Every interface inside this class will be tested, whether it has at least one client, which calls the interface. Only interfaces marked as @PublicEndpoint or as @FrontendEndpoint will be ignored.

@PublicEndpoint has one parameter, which describes, what this Endpoint is used for

@FrontendEndpoint has two parameters. The first points to the Frontend-Module, where this Endpoint is used and the second is a description about what it does.

Gradle Tasks

This plugin will introduce 3 Gradle tasks

verifyFeign checks if there are suitable spring restcontrollers for feignclient interfaces annotated with @VerifyFeign.

verifyController checks if RestControllers are used by clients or are declared as Public- or Frontend-Endpoints.

verifyApi checks if RestControllers are used by clients and clients have suitable rest-interfaces. It does this by calling verifyFeign and verifyController.

All tasks can be found in the group check

Demonstration

A demonstration for this plugin can be found inside exampleProject. This project contains a client and a server. It shows different combinations of client- and server-interfaces. If you call any of the 3 Gradle tasks, they should run without any problem.

You can try commenting out some client- or server-interfaces or delete a @PublicEndpoint or @FrontendEndpoint annotation and rerun the tasks. See how the behavior changes.

You might also like...
A Gradle plugin enforcing pre-commit and commit-msg Git hooks configuration

A Gradle plugin enforcing pre-commit and commit-msg Git hooks configuration. Conventional-commits-ready.

Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options.

Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options. It does this by creating a static library for kotlin compilation, then generates a c+kotlin wrapper that calls into kotlin to start the app, finally using the specified compiler to compile and link the c code and kotlin library into a binary.

Kmp4free - A Gradle Plugin that allows seamless switching between Kotlin JVM and the Kotlin Multiplatform Plugins
Kmp4free - A Gradle Plugin that allows seamless switching between Kotlin JVM and the Kotlin Multiplatform Plugins

🆓 kmp4free Allows you to toggle between Kotlin JVM Plugin - Kotlin Multiplatform with a Gradle Property kmp4free=true. This Gradle Plugin was built

A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically
A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically

A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically elephant project using 100% Kotlin and be up and running in a few seconds.

A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

Grazel is a Gradle plugin to automate generation of valid Bazel files for a given Android/Kotlin/Java project.

Grazel Grazel stands for Gradle to Bazel. It is a Gradle plugin that enables you to migrate Android projects to Bazel build system in an incremental a

 Gradle Plugin for Continuous Integration of AppSweep App Testing.
Gradle Plugin for Continuous Integration of AppSweep App Testing.

This Gradle plugin can be used to continuously integrate app scanning using AppSweep into your Android app build process

Gradle plugin which validates the licenses of your dependency graph match what you expect

Gradle plugin which validates the licenses of your dependency graph match what you expect

Artifactory is a gradle plugin to assist in developing Minecraft mods that can target different modloaders.

Artifactory Artifactory is a gradle plugin to assist in developing Minecraft mods that can target different modloaders. Currently, Fabric and Forge ar

Comments
  • Wrong compare of Controller and Client

    Wrong compare of Controller and Client

    Hi Zakfiel 1312, first of all nice Plugin helps allot.

    But i've run into an issue while checking a new module I wrote.

    The build output should be really clear. If you need more information I will provide it.

    `> Task :aggregateExporter:aggregateExporterClient:verifyFeign FAILED

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':aggregateExporter:aggregateExporterClient:verifyFeign'.

    Controller method: AggregatedItemController.getItemDataByCompanyCodeAndBuyingGroupCode and feignMethod: AggregatedItemOptionClient.getItemOptionDataByCompanyCodeAndBuyingGroupCode match but don't have the same name: Controller: getItemDataByCompanyCodeAndBuyingGroupCode vs Feign: getItemOptionDataByCompanyCodeAndBuyingGroupCode`

    opened by clemens-code 0
  • Problem with overloaded methods

    Problem with overloaded methods

    When methods have the same name and request type, but different parameters, the plugin will most likely throw an error. This is because it only checks the first controller method with the same name and type, even though another one would fit.

    bug 
    opened by Zafkiel1312 0
  • Add support for optional Request Parameters

    Add support for optional Request Parameters

    You can make Request-Parameters optional by adding the required-Parameter: @RequestParam(name = "name", required = false) This is currently not supported but should be

    enhancement 
    opened by Zafkiel1312 0
Owner
null
Android Gradle Plugin -- Auto Check big image and compress image in building.

McImage I will continue to update, please rest assured to use 中文文档 Android优雅的打包时自动化获取全部res资源 McImage is a Non-invasive plugin for compress all res in

smallSohoSolo 1.1k Dec 28, 2022
Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects

Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects. Former: kotlin-ir-plugin-adapter-gradle

null 2 Mar 8, 2022
A Gradle plugin that generates plugin.yml for Bukkit/BungeeCord/Nukkit plugins based on the Gradle project

plugin-yml is a simple Gradle plugin that generates the plugin.yml plugin description file for Bukkit plugins, bungee.yml for Bungee plugins or nukkit.yml for Nukkit plugins based on the Gradle project. Various properties are set automatically (e.g. project name, version or description) and additional properties can be added using a simple DSL.

Plexus 0 Apr 10, 2022
The core Gradle plugin and associated logic used for Slack's Android app

slack-gradle-plugin This repository contains the core Gradle plugin and associated logic used for Slack's Android app. This repo is effectively read-o

Slack 306 Dec 30, 2022
Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Dipien 142 Dec 29, 2022
Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms.

CompleteKotlin Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms. What this plugin provides This zero-conf

Louis CAD 235 Jan 3, 2023
A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes.

Change Tracker Plugin A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes

Ismael Di Vita 110 Dec 19, 2022
Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.

Multiplatform Swift Package This is a Gradle plugin for Kotlin Multiplatform projects that generates an XCFramework for your native Apple targets and

Georg Dresler 262 Jan 5, 2023
Gradle Plugin for publishing artifacts to Sonatype and Nexus

Introduction Due to Sonatype's strict validation rules, the publishing requirement must be satisfied by every artifact which wants to be published to

Johnson Lee 21 Oct 14, 2022
Gradle plugin that parses version updates and assigns them to groups of people.

Notifier Gradle Plugin This gradle plugin serves the need of automating how dependencies are handles in a project. More specifically, it functions usi

Plum 4 Oct 27, 2022