Closed getmehrotra closed 9 years ago
From this: https://github.com/mulesoft/raml-for-jax-rs/blob/master/raml-to-jaxrs/maven-plugin/src/main/java/org/raml/jaxrs/codegen/maven/RamlJaxrsCodegenMojo.java#L147-L153 I think this option is actually supported...
Try adding:
<jsonMapperConfiguration>
<useLongIntegers>true</useLongIntegers>
</jsonMapperConfiguration>
to the plug-in configuration
.
I am using Gradle Plugin. Is this support there as well? How do i need to give this in gradle? From the groovy code for gradle extension it seems gradle plugin doesn't give same level of configurations.
Hi, @getmehrotra
RAML 0.8 specification does not say anything about integer type bounds, so, by default, we have to convert it to long. On the other side, XSD does not have such type as long.
So, in order to make the resulting types the same, we can introduce a generation parameter which says how to treat integer in RAML. We shall implement it in nearest future.
Regards, Konstantin.
@KonstantinSviridov I think @getmehrotra is concerned about JSON Schema, not RAML, because he said "useLongInteger property for JSON to Java conversion".
Can it be supported in a SNAPSHOT version?
Ah! Adding
<jsonMapperConfiguration>
<useLongIntegers>true</useLongIntegers>
</jsonMapperConfiguration>
to configuration works fine. Thank you @ddossot
@ddossot, thanks for correcting me.
@getmehrotra
Seems like it's enough to create a Map<String,String> jsonMapperConfiguration
field for the groovy.org.raml.jaxrs.gradle.RamlExtension
class and then, inside the org.raml.jaxrs.gradle.codegen.CodeGeneratorTask.generate()
method, pass its value into the Configuration
utilized by the generator.
Does it sound fine?
(I will also check if there are more parameters left uncoverd by the Gradle configuration)
Hi, @getmehrotra
We've added jsonMapperConfiguration
and other parameters to the Gradle plugin configuration.
Regards, Konstantin
Hi, The plugin converts Query Parameters of type "integer" as Long in Rest interface. While if we have JSON schema defining request or response and have integer type parameter then it converted as java Integer type. There is no way in the plugin to define useLongInteger property for JSON to Java conversion.
While JSONSchema2POJO supports the parameter.