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

[RAML to code] javadoc missing @param tags #268

Closed thomas-melville closed 6 years ago

thomas-melville commented 6 years ago

Hi,

I'm using your plugin to generate the interface for our controller, thank you very much. There is one thing I see which isn't being generated, the @param tag for each parameter in the generated Controller interface and classes generated from the json schema

Here is my plugin configuration:

<plugin>
        <groupId>com.phoenixnap.oss</groupId>
        <artifactId>springmvc-raml-plugin</artifactId>
        <version>2.0.3</version>
        <executions>
          <execution>
            <id>generate-springmvc-from-raml</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate-springmvc-endpoints</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- Configuration documentation: https://github.com/phoenixnap/springmvc-raml-plugin -->
          <rule>com.phoenixnap.oss.ramlplugin.raml2code.rules.Spring4ControllerInterfaceRule</rule>
          <ruleConfiguration>
            <useShortcutMethodMappings>true</useShortcutMethodMappings>
          </ruleConfiguration>
          <ramlPath>src/main/resources/raml/api.raml</ramlPath>
          <outputRelativePath>${generated-relative-path}</outputRelativePath>
          <basePackage>com.ericsson.orchestration.mgmt.packaging</basePackage>
          <methodsNamingLogic>RESOURCES</methodsNamingLogic>
          <overrideNamingLogicWith>DISPLAY_NAME</overrideNamingLogicWith>
          <generationConfig>
            <includeAdditionalProperties>false</includeAdditionalProperties>
            <includeJsr303Annotations>true</includeJsr303Annotations>
            <useCommonsLang3>true</useCommonsLang3>
            <generateBuilders>true</generateBuilders>
          </generationConfig>
        </configuration>
      </plugin>

My Controller Interface parameters are a mix of path parameters, request bodies and request params.

Is there something I am missing in my configuration or should I be using another feature of the RAML language. I was looking at the unit tests and I'm wondering would annotationTypes help me here?

thomas-melville commented 6 years ago

Hi,

I found the addParameterJavadoc rule configuration option to create the @param in the javadoc of a Controller. The description of parameters which are PathParams is empty though. I tried putting a description field in the RAML but it did not get included. Is there any way to populate the description?

thomas-melville commented 6 years ago

My sincere apologies for opening these issues, I solved this one too. using uriParameters under each path segment I could give a description to that PathParam which shows up in the javadoc.

example:

/{csarId}: description: A specific CSAR uriParameters: csarId: description: the id of the csar type: string

(Not sure what's going on with the indentation)