Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,164 @@
---
name: "Java Spring (Boot + MVC + CloudFeign) Server"
genTemplateId: "com.modelsolv.reprezen.gentemplates.openapi.generator.SpringCodegen"
relativeOutputDir: ../../../implementation/springboot-petstore-demo
prerequisites: null
primarySource:
path: "../../../models/petstore-expanded.yaml"
namedSources: null
# The parameters object contains variables that are processed directly by the GenTemplate.
parameters:
# Sort method arguments to place required parameters before optional parameters.
sortParamsByRequiredFlag: null

# Whether to ensure parameter names are unique in an operation (rename parameters that are not).
ensureUniqueParams: null

# boolean, toggles whether unicode identifiers are allowed in names or not, default is false
allowUnicodeIdentifiers: null

# Add form or body parameters to the beginning of the parameter list.
prependFormOrBodyParameters: null

# package for generated models
modelPackage: com.reprezen.demo.springboot.model

# package for generated api classes
apiPackage: com.reprezen.demo.springboot.api

# root package for generated code
invokerPackage: com.reprezen.demo.springboot

# groupId in generated pom.xml
groupId: com.reprezen.demo

# artifactId in generated pom.xml
artifactId: petstore-demo

# artifact version in generated pom.xml
artifactVersion: null

# artifact URL in generated pom.xml
artifactUrl: null

# artifact description in generated pom.xml
artifactDescription: "Demontration of the Contract-as-Code approach with Spring Boot artifacts generated from an OpenAPI3 doc"

# SCM connection in generated pom.xml
scmConnection: null

# SCM developer connection in generated pom.xml
scmDeveloperConnection: null

# SCM URL in generated pom.xml
scmUrl: null

# developer name in generated pom.xml
developerName: null

# developer email in generated pom.xml
developerEmail: null

# developer organization in generated pom.xml
developerOrganization: null

# developer organization URL in generated pom.xml
developerOrganizationUrl: null

# The name of the license
licenseName: null

# The URL of the license
licenseUrl: null

# source folder for generated code
sourceFolder: null

# prefix for generated code members and local variables
localVariablePrefix: null

# boolean - toggle "implements Serializable" for generated models
serializableModel: null

# Treat BigDecimal values as Strings to avoid precision loss.
bigDecimalAsString: null

# whether to use fully qualified name for classes under java.util. This option only works for Java API client
fullJavaUtil: null

# hides the timestamp when files were generated
hideGenerationTimestamp: true

# whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)
withXml: null

# Option. Date library to use
dateLibrary: null

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

# server title name or client service name
title: null

# configuration package for generated code
configPackage: com.reprezen.demo.springboot.swaggerui

# base package (invokerPackage) for generated code
basePackage: com.reprezen.demo.springboot

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

# Whether to generate the server files using the delegate pattern
delegatePattern: true

# Whether to select only one produces/consumes content-type by operation.
singleContentTypes: null

# use async Callable controllers
async: null

# wrap responses in Mono/Flux Reactor types (spring-boot only)
reactive: null

# wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)
responseWrapper: null

# use tags for creating interface and controller classnames
useTags: null

# Use BeanValidation API annotations
useBeanValidation: null

# Use of @ApiImplicitParams for headers.
implicitHeaders: null

# Generate Spring OpenAPI Docket configuration class.
swaggerDocketConfig: null

# Use Optional container for optional parameters
useOptional: null

# library template (sub-template) to use
library: null

# Contents of OpenAPI Generator configuration file.
# This is the file that would be passed with --config option on OpenAPI Generator commandline.
# The JSON contents of that file should be the value of this parameter.
# 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:
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.
# Example: for '-Dmodels -Dapis=User,Pets' use the following:
# value:
# models: ''
# apis: Users,Pets
openApiCodegenSystemProperties: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apply plugin: 'java'

repositories {
maven {
url "http://maven.reprezen.com/repository/releases"
}
maven {
url "http://maven.reprezen.com/repository/eclipse/"
}
mavenCentral()
}

dependencies {
compile ('com.modelsolv.reprezen:com.modelsolv.reprezen.generators.api:1.6.11.9445')
compile ('com.modelsolv.reprezen:com.modelsolv.reprezen.generators.xtend:1.6.11.9445') {
exclude module: 'org.eclipse.equinox.bidi'
exclude module: 'org.eclipse.emf.common.ui'
exclude module: 'org.eclipse.e4.ui.workbench3'
exclude module: 'org.apache.batik.css'
exclude module: 'org.eclipse.e4.ui.css.swt'
}
compile ('com.modelsolv.reprezen:com.modelsolv.reprezen.generators.standard:1.6.11.9445')
compile fileTree(dir: '/Users/tanya/RepreZen/workspace/shared/GenTemplates', include: ['*.jar'])
compile fileTree(dir: '/Users/tanya/Documents/workspace/Contract-as-Code-Demo-OpenAPI3---Spring-Boot/Expanded Pet Store (v3)/lib', include: ['*.jar'])
}

task(execGenTarget, dependsOn: 'classes', type: JavaExec) {
main = 'com.modelsolv.reprezen.generators.api.util.GeneratorLauncher'
classpath = sourceSets.main.runtimeClasspath
args '/Users/tanya/Documents/workspace/Contract-as-Code-Demo-OpenAPI3---Spring-Boot/Expanded Pet Store (v3)/gentargets/petstore-expanded/Java Spring (Boot + MVC + CloudFeign) Server/Java Spring (Boot + MVC + CloudFeign) Server.gen'
}

defaultTasks 'execGenTarget'
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.modelsolv.reprezen.generators</groupId>
<artifactId>pet-store-expanded</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>java-spring--boot---mvc---cloudfeign--server-gen</artifactId>
<name>GenTarget Launcher For Java Spring (Boot + MVC + CloudFeign) Server.gen</name>
<packaging>pom</packaging>
<properties>
<project.lib.dir>/Users/tanya/Documents/workspace/Contract-as-Code-Demo-OpenAPI3---Spring-Boot/Expanded Pet Store (v3)/lib</project.lib.dir>
<shared.gentemplates.dir>/Users/tanya/RepreZen/workspace/shared/GenTemplates</shared.gentemplates.dir>
</properties>
<build>
<defaultGoal>clean generate-sources</defaultGoal>
<plugins>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${shared.gentemplates.dir}</directory>
</resource>
<resource>
<directory>${project.lib.dir}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<mainClass>com.modelsolv.reprezen.generators.api.util.GeneratorLauncher</mainClass>
<classpathScope>compile</classpathScope>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
<arguments>
<argument>Java Spring (Boot + MVC + CloudFeign) Server.gen</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OpenAPI generated server

Spring Boot Server


## Overview
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework.

The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox)

Start your server as a simple java application

You can view the api documentation in swagger-ui by pointing to
http://localhost:8080/

Change default port value in application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.reprezen.demo</groupId>
<artifactId>petstore-demo</artifactId>
<packaging>jar</packaging>
<name>petstore-demo</name>
<version>1.0.0</version>
<properties>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.8.0</springfox-version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
</parent>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.8.4</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
</dependencies>
</project>
Loading