Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Locally ignored (path-specific) files and directories.
*settings/
*metadata/

# Generator trace file
*.trace.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ parameters:
dateLibrary: null

# Option. Use Java8 classes instead of third party equivalents
java8: true
java8: false

# server title name or client service name
title: null
Expand All @@ -108,7 +108,7 @@ parameters:
basePackage: com.reprezen.demo.springboot

# Whether to generate only API interface stubs without the server files.
interfaceOnly: true
interfaceOnly: false

# Whether to generate the server files using the delegate pattern
delegatePattern: true
Expand Down Expand Up @@ -149,7 +149,11 @@ parameters:
# This parameter need not be used. If it is absent, all string-valued parameters are collected into
# a map that is then passed to the OpenAPI Generator module. If a map is provided here, then string-valued
# parameters are still copied in, overriding like-named values appearing in the map.
openApiCodegenConfig: null
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

# System properties to set, as in the -D option of OpenAPI Generatorcommand line.
# Each property should be a json object with a name/value pair for each property.
Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
# Contract-as-Code-Demo-OpenAPI3---Spring-Boot
Demo for OpenAPI3 to Spring Boot generator
## Work in Progress
# API CodeFlow Spring Boot
Creating a Spring Boot app from an OpenAPI3 document with [SpringCodegen](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java)

To run the code locally
1. `git checkout final`
2. Navigate to the Spring Boot directory: `cd 'Expanded Pet Store (v3)/implementation/springboot-petstore-demo/'`
3. `mvn spring-boot:run`
4. Access API at this URI: http://localhost:8080/api/pets/

To learn more about the Contract-as-Code approach, watch our presentation: [API Contract-As-Code: Rapid Development with OpenAPI](https://www.slideshare.net/TedEpstein/api-contractascode-rapid-development-with-openapi)


# Work in Progress
## Step 1: Design
Describe your RESTful API
* step_1a Create "Expanded Pet Store" Project
* step_1b Add GenTarget for "Java Spring (Boot + MVC + CloudFeign) Server"
* step_1c Modify output folder and packages in the *.gen file

## Step 2: Generate and Implement
Generate code and add customizations
* step_2a Generate code
* step_2b Add implementation to the code

Now you can run the API locally as described above.

## Step 3: Iterate
* step_3a Add a new method to the OAS document
* step_3b Re-generate code
* step_3c Add missing implementation


* ...