Raml-to-jaxrs-maven-plugin ignores jsonMapperConfiguration?

#1

I’m using the raml-to-jaxrs-maven-plugin to generate body objects (for Spring REST, not for JAX-RS).

The problem is that it doesn’t matter what I put inside <jsonMapperConfiguration>. The generated *Impl.java classes are always the same.

Am I using the plugin wrong or am I expecting something that the plugin can’t do?

My config:

<build>
	<plugins>
		<plugin>
			<groupId>org.raml.jaxrs</groupId>
			<artifactId>raml-to-jaxrs-maven-plugin</artifactId>
			<version>3.0.5</version>
			<configuration>
				<ramlFile>${project.build.resources[0].directory}/example.raml</ramlFile>
				<resourcePackage>org.example</resourcePackage>
				<jsonMapper>jackson2</jsonMapper>
				<jsonMapperConfiguration>
					<includeConstructors>true</includeConstructors>
					<includeHashcodeAndEquals>true</includeHashcodeAndEquals>
					<includeToString>true</includeToString>
					<useLongIntegers>true</useLongIntegers>
				</jsonMapperConfiguration>
			</configuration>
			<executions>
				<execution>
					<goals>
						<goal>generate</goal>
					</goals>
					<phase>generate-sources</phase>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>
#2

Show us your RAML?

I just copied the jsonMapperConfiguration block from your post. I pasted it into the pom of versions 3.0.4, 3.0.5 and 3.0.6-SNAPSHOT of simple-json-example.

Running mvn generate-sources worked perfectly in all three versions.

A no-arg constructor, toString(), equals() and hashcode() methods were are generated as expected. The RAML type in simple-json-example doesn’t specify any integer properties. But I don’t doubt that boxed Integers would have been generated if there were such properties defined in the source RAML file.

#3

Thanks for the reply.

The main difference between the example and my raml files is that we are not using schemas, e.g.

The example uses:

types:
    Track:
        schema: |
         {
           "type": "object",
           "$schema": "http://json-schema.org/draft-03/schema",
           "id": "http://jsonschema.net",
           "required": true,
           "properties": {
             "songTitle": {
               "type": "string",
               "required": true
             },
             "albumId": {
               "type": "string",
               "required": true,
               "minLength": 36,
               "maxLength": 36
             }
           }
         }

But we use:

types:
    Track:
       type: object
       required: true
       properties:
           songTitle:
               type: string
               required: true
           albumId:
               type: string
               required: true
               minLength: 36
               maxLength: 36

Any idea why this compiles to COMPLETELY DIFFERENT java files?