-
Notifications
You must be signed in to change notification settings - Fork 2
Getting the generated code
One of the best features of this tool is how easy is getting the endpoint's implementations. Following the next three steps, it will be enough:
First of all, design your API specification. Currently, the API Rest Generator only works with Swagger 2.0 so we recommend checking out the Swagger API Documentation Specification.
Some examples are provided under the File menu. (There are “OSGi” examples that are only compatible with JAX-RS server implementation).
Some custom properties must be added to your specification. You have to declare your business unit to include it in the Maven package when the code will be created. The x-generator-properties field is used for this.
x-generator-properties:
business-unit: mybu
We use a "business-unit" (4 characters) to be part of the package “com.bbva.” for all the artifacts created by the generator (This example will be generated as “com.bbva.mybu.”)
- Only for JAX-RS server generation, you must define the OSGi field as well.
x-generator-properties:
business-unit: mybu
osgi:
architecture_type: online
cxf_address: /AddressPetstoreSimple
cxf_context: /ContextPetstoreSimple
We need to define three different parameters very useful for OSGi (CXF Implementation):
- architecture_type: online or batch.
- cxf_address: this is the first part of the URL path where the REST will be launched.
- cxf_context: this is the second part of the URL path where the REST will be launched.
The next step is to choose your file name for your specification.
Finally, select what flavour you want to generate. You can find the different options in Server and Client menus.
A log window will display and if any error does not arise, a zip file will download with your generated code.