raml-for-jax-rs
raml-for-jax-rs copied to clipboard
Client generator
Should this be: if(generateClientStringValue!=null){ generateClient = Boolean.parseBoolean(generateClientStringValue); } instead of: if(removeOldOutputStringValue!=null){ generateClient = Boolean.parseBoolean(generateClientStringValue); }
https://github.com/mulesoft/raml-for-jax-rs/blob/e3bbfe523460d9b9e77907773cc7d543f0ce782e/raml-to-jaxrs/core/src/main/java/org/raml/jaxrs/codegen/core/Launcher.java#L58
Hi, @WenTingZhu
Here is the place where we insert command line options into generators configuration: https://github.com/mulesoft/raml-for-jax-rs/blob/e3bbfe523460d9b9e77907773cc7d543f0ce782e/raml-to-jaxrs/core/src/main/java/org/raml/jaxrs/codegen/core/Launcher.java#L110-167
I will implement handling of missing arguments before the end of the week.
Regards, Konstantin
Hi Konstantin, the configuration for generateClient is handled up in line57 of Launcher, and I don't think it is necessary to add it into the createConfiguration method?
Also, I think for the annotation type parameter to work, the name of the property has to match the name of the variable. Otherwise the generateClient variable does not change value with changes in the maven pom file.
https://github.com/mulesoft/raml-for-jax-rs/blob/e3bbfe523460d9b9e77907773cc7d543f0ce782e/raml-to-jaxrs/maven-plugin/src/main/java/org/raml/jaxrs/codegen/maven/RamlJaxrsCodegenMojo.java#L114
As for Line 57, you're right. And I think that it's better to have the whole configuration filled in the same place. Otherwise I will always forget that "generateClient" is set somewhere else.
As for maven, for some strange reason it only works fine when the field name equals property name. I've pushed the fix to GitHub and I will soon deploy it to sonatype and mule repo.
Hi,
is it in the maven central already? I've inserted the generateClientProxy argument to the maven config, but what I get generated is still only the service JAX-RS part... Am I missing something? The extension below is just about the name change of the generated resource interface.
Thanks in advance...
<plugin>
<groupId>org.raml.plugins</groupId>
<artifactId>raml-jaxrs-maven-plugin</artifactId>
<version>1.3.4-SNAPSHOT</version>
<configuration>
<!-- Use sourcePaths if you want to provide a single RAML file or a
list of RAML files -->
<sourcePaths>
<param>${resourceDirectory}/api/image-repo-service.raml</param>
</sourcePaths>
<sourceDirectory>${resourceDirectory}/api</sourceDirectory>
<!-- Optionally configure outputDirectory if you don't like the default
value: ${project.build.directory}/generated-sources/raml-JAX-RS -->
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<!-- Replace with your package name -->
<basePackageName>sample.imagerepo.client</basePackageName>
<generateClientProxy>true</generateClientProxy>
<!-- Valid values: 1.1 2.0 -->
<jaxrsVersion>2.0</jaxrsVersion>
<useJsr303Annotations>true</useJsr303Annotations>
<!-- Valid values: jackson1 jackson2 gson none -->
<jsonMapper>gson</jsonMapper>
<removeOldOutput>true</removeOldOutput>
<extensions>
<extension>sample.raml.ImageBuilderExtension</extension>
</extensions>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>sample</groupId>
<artifactId>raml-generator-ext</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
I looked at the source code and did not find where the ClientGenerator or GeneratorProxy is called when using the maven build path. The GeneratorProxy is called from the Launcher, but it is more or less a command line-based generation, correct? Does it at the moment work only from the CLI?
2.0 client generation will come.