I spent some time trying to find a proper tool that is able to generate tidy Java code for REST resources.
My requirements are:
- The Java code must be readable and not polluted with a lot of imports that refer to the tool maker .
- The input should be short and simple.
I stopped by two tools as they were the only ones that would comply with my requirements. They are:
The reason is that a yaml definition file is used as input to Swaggerhub. Also the output consisted of tidy and simple java classes for the server implementations based on jax-rs.
Here it is a yaml specification file you can begin with at Swaggerhub:
swagger: '2.0' info: version: '0' title: Cars Rental Store description: Allow clients to loan cars paths: /rentals: get: summary: Product Types description: | bla bla bla. parameters: - name: rentals_id in: query description: id of. required: true type: number format: double tags: - Rentals responses: 200: description: An array of rentals schema: type: array items: $ref: '#/definitions/Rental' default: description: Unexpected error schema: $ref: '#/definitions/Error' definitions: Car: type: object properties: car_id: type: number description: Unique identifier representing a specific car. title: type: string description: Description of car. Rentals: type: object properties: rental_id: type: string description: Unique identifier representing a specific rental. Cars: type: array items: $ref: "#/definitions/Car" description: bla bla. Error: type: object properties: code: type: integer format: int32 message: type: string fields: type: string