forked from loafle/openapi-generator-original
[kotlin-spring] add reactive behavior via Kotlin coroutines (#2934)
* kotlin spring : add reactivity via kotlin's coroutines * add kotlin spring boot reactive samples * bug : fix spring version and import for coroutines * remove exception handler for reactive (webflux doesn't support it) * add spring milestone repository to maven pom * add reactive type for list in Api and ApiImpl methodes for mathching body responsive parameter * fix baseType for ArraySchema * regenerate samples * updating documentation
This commit is contained in:
parent
b74fa4458d
commit
7916f2f880
4
bin/kotlin-springboot-petstore-all.sh
Executable file
4
bin/kotlin-springboot-petstore-all.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/kotlin-springboot-petstore-server.sh
|
||||
./bin/kotlin-springboot-petstore-server-reactive.sh
|
35
bin/kotlin-springboot-petstore-server-reactive.sh
Executable file
35
bin/kotlin-springboot-petstore-server-reactive.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot-reactive"
|
||||
rm -rf samples/server/petstore/kotlin-springboot-reactive
|
||||
|
||||
echo "Generating Kotling Spring Boot reactive server..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
4
bin/openapi3/kotlin-springboot-petstore-all.sh
Executable file
4
bin/openapi3/kotlin-springboot-petstore-all.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/openapi3/kotlin-springboot-petstore-server.sh
|
||||
./bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
|
35
bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
Executable file
35
bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/openapi3/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot-reactive"
|
||||
rm -rf samples/server/openapi3/petstore/kotlin-springboot-reactive
|
||||
|
||||
echo "Generating Kotling Spring Boot server..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -20,10 +20,11 @@ sidebar_label: kotlin-spring
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|modelPackage|model package for generated code| |org.openapitools.model|
|
||||
|apiPackage|api package for generated code| |org.openapitools.api|
|
||||
|exceptionHandler|generate default global exception handlers| |true|
|
||||
|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true|
|
||||
|gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true|
|
||||
|swaggerAnnotations|generate swagger annotations to go alongside controllers and models| |false|
|
||||
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dl>|spring-boot|
|
||||
|
@ -4707,7 +4707,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.items = codegenProperty.items;
|
||||
codegenParameter.mostInnerItems = codegenProperty.mostInnerItems;
|
||||
codegenParameter.dataType = getTypeDeclaration(arraySchema);
|
||||
codegenParameter.baseType = getSchemaType(arraySchema);
|
||||
codegenParameter.baseType = getSchemaType(inner);
|
||||
codegenParameter.isContainer = Boolean.TRUE;
|
||||
codegenParameter.isListContainer = Boolean.TRUE;
|
||||
|
||||
|
@ -60,6 +60,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String SWAGGER_ANNOTATIONS = "swaggerAnnotations";
|
||||
public static final String SERVICE_INTERFACE = "serviceInterface";
|
||||
public static final String SERVICE_IMPLEMENTATION = "serviceImplementation";
|
||||
public static final String REACTIVE = "reactive";
|
||||
|
||||
|
||||
private String basePackage;
|
||||
private String invokerPackage;
|
||||
@ -72,6 +74,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
private boolean swaggerAnnotations = false;
|
||||
private boolean serviceInterface = false;
|
||||
private boolean serviceImplementation = false;
|
||||
private boolean reactive = false;
|
||||
|
||||
public KotlinSpringServerCodegen() {
|
||||
super();
|
||||
@ -140,7 +143,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort);
|
||||
addOption(CodegenConstants.MODEL_PACKAGE, "model package for generated code", modelPackage);
|
||||
addOption(CodegenConstants.API_PACKAGE, "api package for generated code", apiPackage);
|
||||
addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers", exceptionHandler);
|
||||
addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )", exceptionHandler);
|
||||
addSwitch(GRADLE_BUILD_FILE, "generate a gradle build file using the Kotlin DSL", gradleBuildFile);
|
||||
addSwitch(SWAGGER_ANNOTATIONS, "generate swagger annotations to go alongside controllers and models", swaggerAnnotations);
|
||||
addSwitch(SERVICE_INTERFACE, "generate service interfaces to go alongside controllers. In most " +
|
||||
@ -149,7 +152,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " +
|
||||
"interfaces. If this is set to true service interfaces will also be generated", serviceImplementation);
|
||||
addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation);
|
||||
|
||||
addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive);
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
setLibrary(SPRING_BOOT);
|
||||
|
||||
@ -240,6 +243,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
public boolean isReactive() {
|
||||
return reactive;
|
||||
}
|
||||
|
||||
public void setReactive(boolean reactive) {
|
||||
this.reactive = reactive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
@ -332,6 +343,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
}
|
||||
writePropertyBack(USE_BEANVALIDATION, useBeanValidation);
|
||||
|
||||
if (additionalProperties.containsKey(REACTIVE) && library.equals(SPRING_BOOT)) {
|
||||
this.setReactive(convertPropertyToBoolean(REACTIVE));
|
||||
// spring webflux doesn't support @ControllerAdvice
|
||||
this.setExceptionHandler(false);
|
||||
}
|
||||
writePropertyBack(REACTIVE, reactive);
|
||||
writePropertyBack(EXCEPTION_HANDLER, exceptionHandler);
|
||||
|
||||
modelTemplateFiles.put("model.mustache", ".kt");
|
||||
apiTemplateFiles.put("api.mustache", ".kt");
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
@ -14,7 +14,7 @@ import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
{{#useBeanValidation}}
|
||||
import org.springframework.validation.annotation.Validated
|
||||
{{/useBeanValidation}}
|
||||
@ -39,10 +40,13 @@ import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
{{/useBeanValidation}}
|
||||
|
||||
{{#reactive}}
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
{{/reactive}}
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
{{#useBeanValidation}}
|
||||
@Validated
|
||||
{{/useBeanValidation}}
|
||||
@ -68,12 +72,12 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
|
||||
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}}]){{/swaggerAnnotations}}
|
||||
@RequestMapping(
|
||||
value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"],{{#singleContentTypes}}{{#hasProduces}}
|
||||
produces = "{{{vendorExtensions.x-accepts}}}", {{/hasProduces}}{{#hasConsumes}}
|
||||
produces = "{{{vendorExtensions.x-accepts}}}",{{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}}
|
||||
produces = [{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}}
|
||||
method = [RequestMethod.{{httpMethod}}])
|
||||
fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
|
||||
{{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
|
||||
return {{>returnValue}}
|
||||
}
|
||||
{{/operation}}
|
||||
|
@ -1 +1 @@
|
||||
{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}
|
||||
{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}
|
@ -6,7 +6,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,18 +23,26 @@ tasks.withType<KotlinCompile> {
|
||||
}
|
||||
|
||||
plugins {
|
||||
val kotlinVersion = "1.2.60"
|
||||
val kotlinVersion = "1.3.30"
|
||||
id("org.jetbrains.kotlin.jvm") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
|
||||
id("org.springframework.boot") version "2.0.3.RELEASE"
|
||||
id("org.springframework.boot") version "2.2.0.M3"
|
||||
id("io.spring.dependency-management") version "1.0.5.RELEASE"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val kotlinxCoroutinesVersion="1.2.0"
|
||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
compile("org.jetbrains.kotlin:kotlin-reflect")
|
||||
{{^reactive}}
|
||||
compile("org.springframework.boot:spring-boot-starter-web")
|
||||
{{/reactive}}
|
||||
{{#reactive}}
|
||||
compile("org.springframework.boot:spring-boot-starter-webflux")
|
||||
compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
|
||||
compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion")
|
||||
{{/reactive}}
|
||||
{{#swaggerAnnotations}}
|
||||
compile("io.swagger:swagger-annotations:1.5.21")
|
||||
{{/swaggerAnnotations}}
|
||||
@ -47,3 +55,9 @@ dependencies {
|
||||
exclude(module = "junit")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
}
|
||||
|
@ -6,12 +6,13 @@
|
||||
<name>{{artifactId}}</name>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<properties>
|
||||
<kotlin.version>1.2.60</kotlin.version>
|
||||
<kotlin.version>1.3.30</kotlin.version>
|
||||
<kotlinx-coroutines.version>1.2.0</kotlinx-coroutines.version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
<version>2.2.0.M3</version>
|
||||
</parent>
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
@ -77,8 +78,26 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
{{^reactive}}
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
{{/reactive}}
|
||||
{{#reactive}}
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
{{/reactive}}
|
||||
</dependency>
|
||||
{{#reactive}}
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-coroutines-core</artifactId>
|
||||
<version>${kotlinx-coroutines.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-coroutines-reactor</artifactId>
|
||||
<version>${kotlinx-coroutines.version}</version>
|
||||
</dependency>
|
||||
{{/reactive}}
|
||||
|
||||
{{#swaggerAnnotations}}
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
@ -116,4 +135,34 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
|
@ -1 +1,15 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.springframework.boot") {
|
||||
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rootProject.name = "{{artifactId}}"
|
@ -1 +1 @@
|
||||
{{#isMapContainer}}{{#reactive}}Mono<{{/reactive}}Map<String, {{{returnType}}}{{#reactive}}>{{/reactive}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{#reactive}}Mono<{{{returnType}}}>{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}}{{/returnContainer}}
|
||||
{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flow{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
|
@ -2,12 +2,14 @@ package {{package}}
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
{{#reactive}}
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
{{/reactive}}
|
||||
{{#operations}}
|
||||
interface {{classname}}Service {
|
||||
{{#operation}}
|
||||
|
||||
fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}}
|
||||
{{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
@ -2,13 +2,16 @@ package {{package}}
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
{{#reactive}}
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
{{/reactive}}
|
||||
import org.springframework.stereotype.Service
|
||||
@Service
|
||||
{{#operations}}
|
||||
class {{classname}}ServiceImpl : {{classname}}Service {
|
||||
{{#operation}}
|
||||
|
||||
override fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {
|
||||
override {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {
|
||||
TODO("Implement me")
|
||||
}
|
||||
{{/operation}}
|
||||
|
@ -53,7 +53,7 @@ public class JavaClientCodegenTest {
|
||||
CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet<String>(), null);
|
||||
Assert.assertEquals(codegenParameter1.description, "A list of ids");
|
||||
Assert.assertEquals(codegenParameter1.dataType, "List<String>");
|
||||
Assert.assertEquals(codegenParameter1.baseType, "List");
|
||||
Assert.assertEquals(codegenParameter1.baseType, "String");
|
||||
|
||||
RequestBody body2 = new RequestBody();
|
||||
body2.setDescription("A list of list of values");
|
||||
@ -73,7 +73,7 @@ public class JavaClientCodegenTest {
|
||||
CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet<String>(), null);
|
||||
Assert.assertEquals(codegenParameter3.description, "A list of points");
|
||||
Assert.assertEquals(codegenParameter3.dataType, "List<Point>");
|
||||
Assert.assertEquals(codegenParameter3.baseType, "List");
|
||||
Assert.assertEquals(codegenParameter3.baseType, "Point");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1104,7 +1104,7 @@ public class JavaModelTest {
|
||||
.items(new Schema<>().$ref("#/components/schemas/Pet"));
|
||||
Operation operation = new Operation()
|
||||
.requestBody(new RequestBody()
|
||||
.content(new Content().addMediaType("application/json",
|
||||
.content(new Content().addMediaType("application/json",
|
||||
new MediaType().schema(testSchema))))
|
||||
.responses(
|
||||
new ApiResponses().addApiResponse("204", new ApiResponse()
|
||||
@ -1116,7 +1116,7 @@ public class JavaModelTest {
|
||||
|
||||
Assert.assertEquals(co.bodyParams.size(), 1);
|
||||
CodegenParameter cp1 = co.bodyParams.get(0);
|
||||
Assert.assertEquals(cp1.baseType, "List");
|
||||
Assert.assertEquals(cp1.baseType, "Pet");
|
||||
Assert.assertEquals(cp1.dataType, "List<Pet>");
|
||||
Assert.assertTrue(cp1.isContainer);
|
||||
Assert.assertTrue(cp1.isListContainer);
|
||||
@ -1138,7 +1138,7 @@ public class JavaModelTest {
|
||||
Operation operation = new Operation().responses(
|
||||
new ApiResponses().addApiResponse("200", new ApiResponse()
|
||||
.description("Ok response")
|
||||
.content(new Content().addMediaType("application/json",
|
||||
.content(new Content().addMediaType("application/json",
|
||||
new MediaType().schema(testSchema)))));
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema()));
|
||||
final DefaultCodegen codegen = new JavaClientCodegen();
|
||||
@ -1184,7 +1184,7 @@ public class JavaModelTest {
|
||||
.items(new Schema<>().$ref("#/components/schemas/Pet")));
|
||||
Operation operation = new Operation()
|
||||
.requestBody(new RequestBody()
|
||||
.content(new Content().addMediaType("application/json",
|
||||
.content(new Content().addMediaType("application/json",
|
||||
new MediaType().schema(testSchema))))
|
||||
.responses(
|
||||
new ApiResponses().addApiResponse("204", new ApiResponse()
|
||||
@ -1222,7 +1222,7 @@ public class JavaModelTest {
|
||||
Operation operation = new Operation().responses(
|
||||
new ApiResponses().addApiResponse("200", new ApiResponse()
|
||||
.description("Ok response")
|
||||
.content(new Content().addMediaType("application/json",
|
||||
.content(new Content().addMediaType("application/json",
|
||||
new MediaType().schema(testSchema)))));
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema()));
|
||||
final DefaultCodegen codegen = new JavaClientCodegen();
|
||||
|
@ -47,6 +47,7 @@ public class KotlinSpringServerCodegenTest {
|
||||
codegen.setServiceInterface(true);
|
||||
codegen.setServiceImplementation(true);
|
||||
codegen.setUseBeanValidation(false);
|
||||
codegen.setReactive(false);
|
||||
codegen.processOpts();
|
||||
|
||||
Assert.assertEquals(codegen.modelPackage(), "xx.yyyyyyyy.model");
|
||||
@ -69,6 +70,8 @@ public class KotlinSpringServerCodegenTest {
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true);
|
||||
Assert.assertFalse(codegen.getUseBeanValidation());
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false);
|
||||
Assert.assertFalse(codegen.isReactive());
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -84,6 +87,7 @@ public class KotlinSpringServerCodegenTest {
|
||||
codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_INTERFACE, true);
|
||||
codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION, true);
|
||||
codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_BEANVALIDATION, false);
|
||||
codegen.additionalProperties().put(KotlinSpringServerCodegen.REACTIVE, false);
|
||||
codegen.processOpts();
|
||||
|
||||
final OpenAPI openAPI = new OpenAPI();
|
||||
@ -112,6 +116,8 @@ public class KotlinSpringServerCodegenTest {
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true);
|
||||
Assert.assertFalse(codegen.getUseBeanValidation());
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false);
|
||||
Assert.assertFalse(codegen.isReactive());
|
||||
Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -73,7 +73,7 @@ api.instance$CreateUsersWithArrayInput(var.body)
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](array.md)| List of user object |
|
||||
**body** | [**User**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -110,7 +110,7 @@ api.instance$CreateUsersWithListInput(var.body)
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](array.md)| List of user object |
|
||||
**body** | [**User**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace Example
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -173,7 +173,7 @@ namespace Example
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace Example
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -194,7 +194,7 @@ namespace Example
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -59,7 +59,7 @@ Creates list of users with given input array
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**body** | [**[]User**](array.md)| List of user object |
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -90,7 +90,7 @@ Creates list of users with given input array
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**body** | [**[]User**](array.md)| List of user object |
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class Example {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -173,7 +173,7 @@ public class Example {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class Example {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -173,7 +173,7 @@ public class Example {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -81,7 +81,7 @@ api.createUsersWithArrayInput()
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -121,7 +121,7 @@ api.createUsersWithListInput()
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -91,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](List.md)| List of user object |
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body, (error, data, response) => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body, (error, data, response) => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -85,7 +85,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
createUsersWithArrayInput(body, callback) {
|
||||
@ -125,7 +125,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
createUsersWithListInput(body, callback) {
|
||||
|
@ -85,7 +85,7 @@ apiInstance.createUsersWithArrayInput(body).then(() => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -127,7 +127,7 @@ apiInstance.createUsersWithListInput(body).then(() => {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -84,7 +84,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
|
||||
*/
|
||||
createUsersWithArrayInputWithHttpInfo(body) {
|
||||
@ -116,7 +116,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
|
||||
*/
|
||||
createUsersWithArrayInput(body) {
|
||||
@ -129,7 +129,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
|
||||
*/
|
||||
createUsersWithListInputWithHttpInfo(body) {
|
||||
@ -161,7 +161,7 @@ export default class UserApi {
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
|
||||
*/
|
||||
createUsersWithListInput(body) {
|
||||
|
@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body).then(function() {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body).then(function() {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
|
||||
*/
|
||||
this.createUsersWithArrayInputWithHttpInfo = function(body) {
|
||||
@ -133,7 +133,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
|
||||
*/
|
||||
this.createUsersWithArrayInput = function(body) {
|
||||
@ -146,7 +146,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
|
||||
*/
|
||||
this.createUsersWithListInputWithHttpInfo = function(body) {
|
||||
@ -180,7 +180,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
|
||||
*/
|
||||
this.createUsersWithListInput = function(body) {
|
||||
|
@ -91,7 +91,7 @@ apiInstance.createUsersWithArrayInput(body, callback);
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -136,7 +136,7 @@ apiInstance.createUsersWithListInput(body, callback);
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](Array.md)| List of user object |
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -100,7 +100,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.createUsersWithArrayInput = function(body, callback) {
|
||||
@ -142,7 +142,7 @@
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
* @param {Array.<User>} body List of user object
|
||||
* @param {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.createUsersWithListInput = function(body, callback) {
|
||||
|
@ -89,7 +89,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -89,7 +89,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -89,7 +89,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object |
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi(
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client()
|
||||
);
|
||||
$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
|
||||
try {
|
||||
$apiInstance->createUsersWithArrayInput($body);
|
||||
@ -103,7 +103,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object |
|
||||
**body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi(
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client()
|
||||
);
|
||||
$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
|
||||
try {
|
||||
$apiInstance->createUsersWithListInput($body);
|
||||
@ -156,7 +156,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object |
|
||||
**body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -83,7 +83,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -96,7 +96,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -134,7 +134,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -147,7 +147,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -83,7 +83,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -96,7 +96,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -134,7 +134,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -147,7 +147,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -83,7 +83,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -96,7 +96,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -134,7 +134,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = None # list[User] | List of user object
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -147,7 +147,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](list.md)| List of user object |
|
||||
**body** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -74,7 +74,7 @@ Creates list of users with given input array
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
body = nil # Array<User> | List of user object
|
||||
body = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
@ -89,7 +89,7 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Array<User>**](Array.md)| List of user object |
|
||||
**body** | [**Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -118,7 +118,7 @@ Creates list of users with given input array
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
body = nil # Array<User> | List of user object
|
||||
body = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
@ -133,7 +133,7 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Array<User>**](Array.md)| List of user object |
|
||||
**body** | [**Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi(
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client()
|
||||
);
|
||||
$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
|
||||
try {
|
||||
$apiInstance->createUsersWithArrayInput($user);
|
||||
@ -103,7 +103,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object |
|
||||
**user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi(
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client()
|
||||
);
|
||||
$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
|
||||
|
||||
try {
|
||||
$apiInstance->createUsersWithListInput($user);
|
||||
@ -156,7 +156,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object |
|
||||
**user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -83,7 +83,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
user = None # list[User] | List of user object
|
||||
user = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -96,7 +96,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**list[User]**](list.md)| List of user object |
|
||||
**user** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -134,7 +134,7 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
user = None # list[User] | List of user object
|
||||
user = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
@ -147,7 +147,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**list[User]**](list.md)| List of user object |
|
||||
**user** | [**list[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -74,7 +74,7 @@ Creates list of users with given input array
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
user = nil # Array<User> | List of user object
|
||||
user = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
@ -89,7 +89,7 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Array<User>**](Array.md)| List of user object |
|
||||
**user** | [**Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -118,7 +118,7 @@ Creates list of users with given input array
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
user = nil # Array<User> | List of user object
|
||||
user = [Petstore::User.new] # Array<User> | List of user object
|
||||
|
||||
begin
|
||||
#Creates list of users with given input array
|
||||
@ -133,7 +133,7 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Array<User>**](Array.md)| List of user object |
|
||||
**user** | [**Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -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
|
@ -0,0 +1 @@
|
||||
4.0.1-SNAPSHOT
|
@ -0,0 +1,21 @@
|
||||
# openAPIPetstore
|
||||
|
||||
This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator).
|
||||
|
||||
## Getting Started
|
||||
|
||||
This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in.
|
||||
|
||||
By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl).
|
||||
|
||||
To build the project using maven, run:
|
||||
```bash
|
||||
mvn package && java -jar target/openapi-spring-1.0.0.jar
|
||||
```
|
||||
|
||||
To build the project using gradle, run:
|
||||
```bash
|
||||
gradle build && java -jar build/libs/openapi-spring-1.0.0.jar
|
||||
```
|
||||
|
||||
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)
|
@ -0,0 +1,55 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
|
||||
}
|
||||
}
|
||||
|
||||
group = "org.openapitools"
|
||||
version = "1.0.0"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
plugins {
|
||||
val kotlinVersion = "1.3.30"
|
||||
id("org.jetbrains.kotlin.jvm") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
|
||||
id("org.springframework.boot") version "2.2.0.M3"
|
||||
id("io.spring.dependency-management") version "1.0.5.RELEASE"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val kotlinxCoroutinesVersion="1.2.0"
|
||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
compile("org.jetbrains.kotlin:kotlin-reflect")
|
||||
compile("org.springframework.boot:spring-boot-starter-webflux")
|
||||
compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
|
||||
compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion")
|
||||
compile("io.swagger:swagger-annotations:1.5.21")
|
||||
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
|
||||
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||
exclude(module = "junit")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
<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>org.openapitools</groupId>
|
||||
<artifactId>openapi-spring</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>openapi-spring</name>
|
||||
<version>1.0.0</version>
|
||||
<properties>
|
||||
<kotlin.version>1.3.30</kotlin.version>
|
||||
<kotlinx-coroutines.version>1.2.0</kotlinx-coroutines.version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.0.M3</version>
|
||||
</parent>
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<version>${kotlin.version}</version>
|
||||
<configuration>
|
||||
<compilerPlugins>
|
||||
<plugin>spring</plugin>
|
||||
</compilerPlugins>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-allopen</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-reflect</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-coroutines-core</artifactId>
|
||||
<version>${kotlinx-coroutines.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-coroutines-reactor</artifactId>
|
||||
<version>${kotlinx-coroutines.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-kotlin</artifactId>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.springframework.boot") {
|
||||
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rootProject.name = "openapi-spring"
|
@ -0,0 +1,14 @@
|
||||
package org.openapitools
|
||||
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"])
|
||||
class Application
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<Application>(*args)
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Pet", description = "The Pet API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
|
||||
@ApiOperation(
|
||||
value = "Add a new pet to the store",
|
||||
nickname = "addPet",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Deletes a pet",
|
||||
nickname = "deletePet",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid pet value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Finds Pets by status",
|
||||
nickname = "findPetsByStatus",
|
||||
notes = "Multiple status values can be provided with comma separated strings",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List<String>
|
||||
): ResponseEntity<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Finds Pets by tags",
|
||||
nickname = "findPetsByTags",
|
||||
notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List<String>
|
||||
,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int?
|
||||
): ResponseEntity<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Find pet by ID",
|
||||
nickname = "getPetById",
|
||||
notes = "Returns a single pet",
|
||||
response = Pet::class,
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Update an existing pet",
|
||||
nickname = "updatePet",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Updates a pet in the store with form data",
|
||||
nickname = "updatePetWithForm",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "uploads an image",
|
||||
nickname = "uploadFile",
|
||||
notes = "",
|
||||
response = ModelApiResponse::class,
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}/uploadImage"],
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
|
||||
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
||||
): ResponseEntity<ModelApiResponse> {
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface PetApiService {
|
||||
|
||||
suspend fun addPet(pet: Pet): Unit
|
||||
|
||||
suspend fun deletePet(petId: Long, apiKey: String?): Unit
|
||||
|
||||
fun findPetsByStatus(status: List<String>): Flow<Pet>
|
||||
|
||||
fun findPetsByTags(tags: List<String>, maxCount: Int?): Flow<Pet>
|
||||
|
||||
suspend fun getPetById(petId: Long): Pet
|
||||
|
||||
suspend fun updatePet(pet: Pet): Unit
|
||||
|
||||
suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
||||
|
||||
suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class PetApiServiceImpl : PetApiService {
|
||||
|
||||
override suspend fun addPet(pet: Pet): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deletePet(petId: Long, apiKey: String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByStatus(status: List<String>): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByTags(tags: List<String>, maxCount: Int?): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getPetById(petId: Long): Pet {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updatePet(pet: Pet): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Store", description = "The Store API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class StoreApiController(@Autowired(required = true) val service: StoreApiService) {
|
||||
|
||||
@ApiOperation(
|
||||
value = "Delete purchase order by ID",
|
||||
nickname = "deleteOrder",
|
||||
notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors")
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Returns pet inventories by status",
|
||||
nickname = "getInventory",
|
||||
notes = "Returns a map of status codes to quantities",
|
||||
response = Int::class,
|
||||
responseContainer = "Map",
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")])
|
||||
@RequestMapping(
|
||||
value = ["/store/inventory"],
|
||||
produces = ["application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getInventory(): ResponseEntity<Map<String, Int>> {
|
||||
return ResponseEntity(service.getInventory(), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Find purchase order by ID",
|
||||
nickname = "getOrderById",
|
||||
notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||
response = Order::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Place an order for a pet",
|
||||
nickname = "placeOrder",
|
||||
notes = "",
|
||||
response = Order::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.placeOrder(order), HttpStatus.OK)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface StoreApiService {
|
||||
|
||||
suspend fun deleteOrder(orderId: String): Unit
|
||||
|
||||
suspend fun getInventory(): Map<String, Int>
|
||||
|
||||
suspend fun getOrderById(orderId: Long): Order
|
||||
|
||||
suspend fun placeOrder(order: Order): Order
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class StoreApiServiceImpl : StoreApiService {
|
||||
|
||||
override suspend fun deleteOrder(orderId: String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getInventory(): Map<String, Int> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getOrderById(orderId: Long): Order {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun placeOrder(order: Order): Order {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "User", description = "The User API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class UserApiController(@Autowired(required = true) val service: UserApiService) {
|
||||
|
||||
@ApiOperation(
|
||||
value = "Create user",
|
||||
nickname = "createUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUser(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithArrayInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/createWithArray"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithListInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/createWithList"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Delete user",
|
||||
nickname = "deleteUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Get user by user name",
|
||||
nickname = "getUserByName",
|
||||
notes = "",
|
||||
response = User::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String
|
||||
): ResponseEntity<User> {
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Logs user into the system",
|
||||
nickname = "loginUser",
|
||||
notes = "",
|
||||
response = String::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||
@RequestMapping(
|
||||
value = ["/user/login"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String
|
||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String
|
||||
): ResponseEntity<String> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Logs out current logged in user session",
|
||||
nickname = "logoutUser",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/logout"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun logoutUser(): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.logoutUser(), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Updated user",
|
||||
nickname = "updateUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String
|
||||
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updateUser(username, user), HttpStatus.OK)
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface UserApiService {
|
||||
|
||||
suspend fun createUser(user: User): Unit
|
||||
|
||||
suspend fun createUsersWithArrayInput(user: Flow<User>): Unit
|
||||
|
||||
suspend fun createUsersWithListInput(user: Flow<User>): Unit
|
||||
|
||||
suspend fun deleteUser(username: String): Unit
|
||||
|
||||
suspend fun getUserByName(username: String): User
|
||||
|
||||
suspend fun loginUser(username: String, password: String): String
|
||||
|
||||
suspend fun logoutUser(): Unit
|
||||
|
||||
suspend fun updateUser(username: String, user: User): Unit
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class UserApiServiceImpl : UserApiService {
|
||||
|
||||
override suspend fun createUser(user: User): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun createUsersWithArrayInput(user: Flow<User>): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun createUsersWithListInput(user: Flow<User>): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deleteUser(username: String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getUserByName(username: String): User {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun loginUser(username: String, password: String): String {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun logoutUser(): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updateUser(username: String, user: User): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Category (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
*/
|
||||
data class InlineObject (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated name of the pet")
|
||||
@JsonProperty("name") val name: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated status of the pet")
|
||||
@JsonProperty("status") val status: String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
*
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
*/
|
||||
data class InlineObject1 (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Additional data to pass to server")
|
||||
@JsonProperty("additionalMetadata") val additionalMetadata: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "file to upload")
|
||||
@JsonProperty("file") val file: org.springframework.core.io.Resource? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
* @param code
|
||||
* @param type
|
||||
* @param message
|
||||
*/
|
||||
data class ModelApiResponse (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") val code: Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") val type: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") val message: String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.annotation.JsonValue
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
* @param id
|
||||
* @param petId
|
||||
* @param quantity
|
||||
* @param shipDate
|
||||
* @param status Order Status
|
||||
* @param complete
|
||||
*/
|
||||
data class Order (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") val petId: Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") val quantity: Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
@JsonProperty("status") val status: Order.Status? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") val complete: Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
|
||||
@JsonProperty("placed") placed("placed"),
|
||||
|
||||
@JsonProperty("approved") approved("approved"),
|
||||
|
||||
@JsonProperty("delivered") delivered("delivered");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.annotation.JsonValue
|
||||
import org.openapitools.model.Category
|
||||
import org.openapitools.model.Tag
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
* @param id
|
||||
* @param category
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
data class Pet (
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") val name: String,
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") val photoUrls: List<String>,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") val category: Category? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") val tags: List<Tag>? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
@JsonProperty("status") val status: Pet.Status? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* Values: available,pending,sold
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
|
||||
@JsonProperty("available") available("available"),
|
||||
|
||||
@JsonProperty("pending") pending("pending"),
|
||||
|
||||
@JsonProperty("sold") sold("sold");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Tag (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
* @param id
|
||||
* @param username
|
||||
* @param firstName
|
||||
* @param lastName
|
||||
* @param email
|
||||
* @param password
|
||||
* @param phone
|
||||
* @param userStatus User Status
|
||||
*/
|
||||
data class User (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") val username: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") val firstName: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") val lastName: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") val email: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") val password: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") val phone: String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") val userStatus: Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
spring:
|
||||
application:
|
||||
name: openAPIPetstore
|
||||
|
||||
jackson:
|
||||
serialization:
|
||||
WRITE_DATES_AS_TIMESTAMPS: false
|
||||
|
||||
server:
|
||||
port: 8080
|
@ -1 +1 @@
|
||||
4.0.0-SNAPSHOT
|
||||
4.0.1-SNAPSHOT
|
@ -6,7 +6,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,15 +23,16 @@ tasks.withType<KotlinCompile> {
|
||||
}
|
||||
|
||||
plugins {
|
||||
val kotlinVersion = "1.2.60"
|
||||
val kotlinVersion = "1.3.30"
|
||||
id("org.jetbrains.kotlin.jvm") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
|
||||
id("org.springframework.boot") version "2.0.3.RELEASE"
|
||||
id("org.springframework.boot") version "2.2.0.M3"
|
||||
id("io.spring.dependency-management") version "1.0.5.RELEASE"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val kotlinxCoroutinesVersion="1.2.0"
|
||||
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
compile("org.jetbrains.kotlin:kotlin-reflect")
|
||||
compile("org.springframework.boot:spring-boot-starter-web")
|
||||
@ -44,3 +45,9 @@ dependencies {
|
||||
exclude(module = "junit")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
}
|
||||
|
@ -6,12 +6,13 @@
|
||||
<name>openapi-spring</name>
|
||||
<version>1.0.0</version>
|
||||
<properties>
|
||||
<kotlin.version>1.2.60</kotlin.version>
|
||||
<kotlin.version>1.3.30</kotlin.version>
|
||||
<kotlinx-coroutines.version>1.2.0</kotlinx-coroutines.version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
<version>2.2.0.M3</version>
|
||||
</parent>
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
@ -79,6 +80,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
@ -106,4 +108,34 @@
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
|
@ -1 +1,15 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.springframework.boot") {
|
||||
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rootProject.name = "openapi-spring"
|
@ -2,11 +2,17 @@ package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import io.swagger.annotations.*
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
@ -14,18 +20,24 @@ import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.*
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Pet", description = "The Pet API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
@ -42,7 +54,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity<Unit> {
|
||||
fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -56,7 +69,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
fun deletePet(@ApiParam(value = "Pet id to delete", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "" , defaultValue="null") @RequestHeader(value="api_key", required=false) apiKey: String): ResponseEntity<Unit> {
|
||||
fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -73,7 +88,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "null") @Valid @RequestParam(value = "status", required = true, defaultValue="null") status: List<String>): ResponseEntity<List<Pet>> {
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List<String>
|
||||
): ResponseEntity<List<Pet>> {
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -90,8 +106,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "null") @Valid @RequestParam(value = "tags", required = true, defaultValue="null") tags: List<String>): ResponseEntity<List<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK)
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List<String>
|
||||
,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int?
|
||||
): ResponseEntity<List<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@ -106,7 +124,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun getPetById(@ApiParam(value = "ID of pet to return", required=true, defaultValue="null") @PathVariable("petId") petId: Long): ResponseEntity<Pet> {
|
||||
fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -121,7 +140,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity<Unit> {
|
||||
fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -136,7 +156,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity<Unit> {
|
||||
fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -153,7 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
fun uploadFile(@ApiParam(value = "ID of pet to update", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity<ModelApiResponse> {
|
||||
fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
|
||||
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
||||
): ResponseEntity<ModelApiResponse> {
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
@ -2,22 +2,21 @@ package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
|
||||
interface PetApiService {
|
||||
|
||||
fun addPet(pet: Pet): Unit
|
||||
fun addPet(pet: Pet): Unit
|
||||
|
||||
fun deletePet(petId: Long,apiKey: String): Unit
|
||||
fun deletePet(petId: Long, apiKey: String?): Unit
|
||||
|
||||
fun findPetsByStatus(status: List<String>): List<Pet>
|
||||
fun findPetsByStatus(status: List<String>): List<Pet>
|
||||
|
||||
fun findPetsByTags(tags: List<String>): List<Pet>
|
||||
fun findPetsByTags(tags: List<String>, maxCount: Int?): List<Pet>
|
||||
|
||||
fun getPetById(petId: Long): Pet
|
||||
fun getPetById(petId: Long): Pet
|
||||
|
||||
fun updatePet(pet: Pet): Unit
|
||||
fun updatePet(pet: Pet): Unit
|
||||
|
||||
fun updatePetWithForm(petId: Long,name: String,status: String): Unit
|
||||
fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
||||
|
||||
fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse
|
||||
fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package org.openapitools.api
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class PetApiServiceImpl : PetApiService {
|
||||
|
||||
@ -11,7 +10,7 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun deletePet(petId: Long,apiKey: String): Unit {
|
||||
override fun deletePet(petId: Long, apiKey: String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@ -19,7 +18,7 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByTags(tags: List<String>): List<Pet> {
|
||||
override fun findPetsByTags(tags: List<String>, maxCount: Int?): List<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@ -31,11 +30,11 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun updatePetWithForm(petId: Long,name: String,status: String): Unit {
|
||||
override fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse {
|
||||
override fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import io.swagger.annotations.*
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.*
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Store", description = "The Store API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
@ -39,7 +51,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true, defaultValue="null") @PathVariable("orderId") orderId: String): ResponseEntity<Unit> {
|
||||
fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -71,7 +84,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
value = ["/store/order/{orderId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true, defaultValue="null") @PathVariable("orderId") orderId: Long): ResponseEntity<Order> {
|
||||
fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -87,7 +101,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity<Order> {
|
||||
fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.placeOrder(order), HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
|
||||
interface StoreApiService {
|
||||
|
||||
fun deleteOrder(orderId: String): Unit
|
||||
fun deleteOrder(orderId: String): Unit
|
||||
|
||||
fun getInventory(): Map<String, Int>
|
||||
fun getInventory(): Map<String, Int>
|
||||
|
||||
fun getOrderById(orderId: Long): Order
|
||||
fun getOrderById(orderId: Long): Order
|
||||
|
||||
fun placeOrder(order: Order): Order
|
||||
fun placeOrder(order: Order): Order
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class StoreApiServiceImpl : StoreApiService {
|
||||
|
||||
|
@ -1,11 +1,17 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import io.swagger.annotations.*
|
||||
import io.swagger.annotations.Api
|
||||
import io.swagger.annotations.ApiOperation
|
||||
import io.swagger.annotations.ApiParam
|
||||
import io.swagger.annotations.ApiResponse
|
||||
import io.swagger.annotations.ApiResponses
|
||||
import io.swagger.annotations.Authorization
|
||||
import io.swagger.annotations.AuthorizationScope
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestHeader
|
||||
import org.springframework.web.bind.annotation.RequestMethod
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.context.request.NativeWebRequest
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.*
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.Map
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "User", description = "The User API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
@ -41,7 +53,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity<Unit> {
|
||||
fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUser(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -56,7 +69,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/createWithArray"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>): ResponseEntity<Unit> {
|
||||
fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -71,7 +85,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/createWithList"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>): ResponseEntity<Unit> {
|
||||
fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -85,7 +100,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity<Unit> {
|
||||
fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -100,7 +116,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/{username}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity<User> {
|
||||
fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String
|
||||
): ResponseEntity<User> {
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -115,7 +132,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/login"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity<String> {
|
||||
fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String
|
||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String
|
||||
): ResponseEntity<String> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK)
|
||||
}
|
||||
|
||||
@ -144,7 +163,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/{username}"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.PUT])
|
||||
fun updateUser(@ApiParam(value = "name that need to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity<Unit> {
|
||||
fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String
|
||||
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updateUser(username, user), HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,21 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
|
||||
interface UserApiService {
|
||||
|
||||
fun createUser(user: User): Unit
|
||||
fun createUser(user: User): Unit
|
||||
|
||||
fun createUsersWithArrayInput(user: List<User>): Unit
|
||||
fun createUsersWithArrayInput(user: List<User>): Unit
|
||||
|
||||
fun createUsersWithListInput(user: List<User>): Unit
|
||||
fun createUsersWithListInput(user: List<User>): Unit
|
||||
|
||||
fun deleteUser(username: String): Unit
|
||||
fun deleteUser(username: String): Unit
|
||||
|
||||
fun getUserByName(username: String): User
|
||||
fun getUserByName(username: String): User
|
||||
|
||||
fun loginUser(username: String,password: String): String
|
||||
fun loginUser(username: String, password: String): String
|
||||
|
||||
fun logoutUser(): Unit
|
||||
fun logoutUser(): Unit
|
||||
|
||||
fun updateUser(username: String,user: User): Unit
|
||||
fun updateUser(username: String, user: User): Unit
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class UserApiServiceImpl : UserApiService {
|
||||
|
||||
@ -26,7 +25,7 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun loginUser(username: String,password: String): String {
|
||||
override fun loginUser(username: String, password: String): String {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@ -34,7 +33,7 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun updateUser(username: String,user: User): Unit {
|
||||
override fun updateUser(username: String, user: User): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,13 @@ package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.*
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,13 @@ package org.openapitools.model
|
||||
|
||||
import java.util.Objects
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.*
|
||||
import javax.validation.constraints.DecimalMax
|
||||
import javax.validation.constraints.DecimalMin
|
||||
import javax.validation.constraints.Max
|
||||
import javax.validation.constraints.Min
|
||||
import javax.validation.constraints.NotNull
|
||||
import javax.validation.constraints.Pattern
|
||||
import javax.validation.constraints.Size
|
||||
import io.swagger.annotations.ApiModelProperty
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user