Skip to content

Conversation

tfesenko
Copy link
Member

@tfesenko tfesenko commented Sep 25, 2018

1. Add a new GenTarget for "Java Spring (Boot + MVC + CloudFeign) Server".

screen shot 2018-09-24 at 9 24 59 pm

The result should be similar to what you can find on branch step_1b.

2. Update pom.xml to use latest OpenAPI Generator

Add this to the root pom.xml file of the RepreZen project root folder(not the pom.xml file in the newly created GenTemplate folder):

        <dependency>
        	<groupId>org.openapitools</groupId>
        	<artifactId>openapi-generator</artifactId>
        	<version>3.2.3</version>
        </dependency>

3. Update parameters in Java Spring (Boot + MVC + CloudFeign) Server.gen file

Change the following parameters
For output location and packages:

  • relativeOutputDir: ../../../implementation/springboot-petstore-demo
  • modelPackage: com.reprezen.demo.springboot.model
  • apiPackage: com.reprezen.demo.springboot.api
  • invokerPackage: com.reprezen.demo.springboot
  • configPackage: com.reprezen.demo.springboot.swaggerui
  • basePackage: com.reprezen.demo.springboot

For maven artifacts:

  • groupId: com.reprezen.demo
  • artifactId: petstore-demo
  • artifactDescription: "Demontration of the Contract-as-Code approach with Spring Boot artifacts generated from an OpenAPI3 doc"

For generated Java classes:

  openApiCodegenConfig: 
    hideGenerationTimestamp: true
    delegatePattern: true
    # the java8 option generates default methods in interfaces which. Because of it, unimplemented methods in interface implementations will NOT be detected by the compiler.  
    java8: false

Git branch: step_1c

4. Generate Spring Boot code running the "Generate Java Spring (Boot + MVC + CloudFeign) Server" action from the toolbar.

screen shot 2018-09-24 at 6 09 21 pm

5. Create a new Eclipse project for generated artifacts

Open the generated artifacts as a project by right-clicking on the implementation folder and selecing "Import > Maven / Existing Maven Project". This will create a new "petstore-demo" Maven project in API Studio.


Notice that we have PetsApiDelegate among other generated artifacts. We will provide implementation of this interface in the next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant