I updated my raml to look like this:
description: Get all books
My ultimate goal is define an API in RAML and some way define my objects (JSON schemas, types, definitions, whatever), and then be able to auto-generate code based on those definitions. We originally had the API defined in RAML and JSON schema files defined for the objects and used RAML for JAX-RS to generate the Java classes. However, we ran into issues with the plugin only supporting RAML 0.8 and needing RAML 1.0 to use JSON schemas that referenced other JSON schemas. I have been trying to find a way to get this to work.
When I ran the RAML for JAX-RS, I get this response:
[ERROR] Failed to execute goal org.raml.plugins:raml-jaxrs-maven-plugin:1.3.4:generate (default-cli) on project BookService: Error generating Java classes from: C:\Devel\JavaProjects\BookService\src\api\BookService2.raml: Invalid RAML definition:
[ERROR] ERROR Unknown key: type (line 7, col 4 to 8)
[ERROR] ERROR Unknown key: type (line 10, col 8 to 12)
[ERROR] ERROR Unknown key: required (line 11, col 8 to 16)
[ERROR] ERROR Unknown key: isbn (line 9, col 6 to 10)
[ERROR] ERROR Unknown key: type (line 13, col 8 to 12)
... snip ....
Is there a way to define the objects such that RAML for JAX-RS can create model objects where one object is referenced in another?
I have tried writing the API in Swagger and referencing JSON schema files and using the swagger-codegen tool and it generates the models as expected. However, I prefer the cleaner way that RAML for JAX-RS defines the resource interface and other service classes.