phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

Suppress Generation of Controller / Decorator for specific endpoints #263

Closed chrisjamesconnor closed 6 years ago

chrisjamesconnor commented 6 years ago

Hi currently use our RAML for two purposes. 1 to generate API model for our spring boot apps and 2. To provide “contract validation” in a mulesoft gateway (ensure that all incoming requests match raml before being passed to our API).

We would like to expose “standard” spring endpoints (metrics / health) and as such add them to our RAML but not autogen controllers / decorators for these. This would allow the downstream gateway to forward to them and let spring boot do the rest.

Is there a way to suppress autogeneration for specific end points?

stojsavljevic commented 6 years ago

At the moment, no. But this is a valid feature request.

What do you think, what will be the best way to introduce this? Maybe the best way will be to recognize certain annotation, e.g. endpoints with skipCodeGeneration annotation will be ignored.

chrisjamesconnor commented 6 years ago

Hi - thanks for the quick response. Just looked at a work around using the maven-antrun-plugin. You can specify files to delete during build with that (generated sources and classes). It’s a workaround for the moment ...

stojsavljevic commented 6 years ago

I introduced dontGenerateForAnnotation configuration option. The value is annotation name. When defined annotation is found on resource or method - code generation will be skipped. Keep in mind that when defined on resource - all methods in that resources and all of the subresources will be ignored (code will not be generated for them).