diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml index aa5349199a92..931593dff958 100644 --- a/.github/workflows/samples-kotlin-server.yaml +++ b/.github/workflows/samples-kotlin-server.yaml @@ -39,7 +39,6 @@ jobs: - samples/server/petstore/kotlin-springboot-reactive-without-flow - samples/server/petstore/kotlin-springboot-source-swagger1 - samples/server/petstore/kotlin-springboot-source-swagger2 - - samples/server/petstore/kotlin-springboot-springfox - samples/server/petstore/kotlin-springboot-x-kotlin-implements - samples/server/petstore/kotlin-springboot-include-http-request-context-delegate - samples/server/petstore/kotlin-server/ktor2 diff --git a/bin/configs/kotlin-spring-boot-springfox.yaml b/bin/configs/kotlin-spring-boot-springfox.yaml deleted file mode 100644 index 9e0bc3e274cb..000000000000 --- a/bin/configs/kotlin-spring-boot-springfox.yaml +++ /dev/null @@ -1,12 +0,0 @@ -generatorName: kotlin-spring -outputDir: samples/server/petstore/kotlin-springboot-springfox -library: spring-boot -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml -templateDir: modules/openapi-generator/src/main/resources/kotlin-spring -additionalProperties: - documentationProvider: springfox - annotationLibrary: swagger1 - useSwaggerUI: "true" - serviceImplementation: "true" - serializableModel: "true" - beanValidations: "true" diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index df75fc19b7ee..6c43046fbfb9 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |configPackage|configuration package for generated code| |org.openapitools.configuration| |declarativeInterfaceReactiveMode|What type of reactive style to use in Spring Http declarative interface|
**coroutines**
Use kotlin-idiomatic 'suspend' functions
**reactor**
Use reactor return wrappers 'Mono' and 'Flux'
|coroutines| |delegatePattern|Whether to generate the server files using the delegate pattern| |false| -|documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| +|documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original| |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| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index f3037ad16c85..6730dd636649 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -348,7 +348,6 @@ public List supportedDocumentationProvider() { return Arrays.asList( DocumentationProvider.NONE, DocumentationProvider.SOURCE, - DocumentationProvider.SPRINGFOX, DocumentationProvider.SPRINGDOC ); } @@ -369,8 +368,7 @@ public List supportedAnnotationLibraries() { * @return true if the selected DocumentationProvider requires us to bootstrap swagger-ui. */ private boolean selectedDocumentationProviderRequiresSwaggerUiBootstrap() { - return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) || - getDocumentationProvider().equals(DocumentationProvider.SOURCE); + return getDocumentationProvider().equals(DocumentationProvider.SOURCE); } public boolean getExceptionHandler() { @@ -433,10 +431,6 @@ public void processOpts() { super.processOpts(); - if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) { - LOGGER.warn("The springfox documentation provider is deprecated for removal. Use the springdoc provider instead."); - } - if (null != defaultDocumentationProvider()) { documentationProvider = DocumentationProvider.ofCliOption( (String) additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER, @@ -514,7 +508,6 @@ public void processOpts() { } // Spring-specific import mappings for x-spring-paginated support - importMapping.put("ApiIgnore", "springfox.documentation.annotations.ApiIgnore"); importMapping.put("ParameterObject", "org.springdoc.api.annotations.ParameterObject"); importMapping.put("PageableAsQueryParam", "org.springdoc.core.converters.models.PageableAsQueryParam"); if (useSpringBoot3) { @@ -725,9 +718,6 @@ public void processOpts() { } if (isUseSpringBoot3() || isUseSpringBoot4()) { - if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) { - throw new IllegalArgumentException(DocumentationProvider.SPRINGFOX.getPropertyName() + " is not supported with Spring Boot > 3.x"); - } if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) { throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x"); } @@ -899,11 +889,7 @@ public void processOpts() { } if (!reactive && !(library.equals(SPRING_CLOUD_LIBRARY) || library.equals(SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY))) { - if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) { - supportingFiles.add(new SupportingFile("springfoxDocumentationConfig.mustache", - (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), - "SpringFoxConfiguration.kt")); - } else if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) { + if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) { supportingFiles.add(new SupportingFile("springdocDocumentationConfig.mustache", (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "SpringDocConfiguration.kt")); @@ -970,7 +956,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera * When x-spring-paginated is set to true on an operation, this method: * - Adds org.springframework.data.domain.Pageable parameter to the method signature * - Removes the default Spring Data Web pagination query parameters (page, size, sort) - * - Adds appropriate imports (Pageable, ApiIgnore for springfox, ParameterObject for springdoc) + * - Adds appropriate imports (Pageable, ParameterObject for springdoc) * * Auto-detection (when autoXSpringPaginated is enabled): * - Automatically detects operations with 'page', 'size', and 'sort' query parameters (case-sensitive) @@ -1037,9 +1023,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation // add org.springframework.data.domain.Pageable import when needed (server libraries only) if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-spring-paginated"))) { codegenOperation.imports.add("Pageable"); - if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) { - codegenOperation.imports.add("ApiIgnore"); - } if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) { codegenOperation.imports.add("PageableAsQueryParam"); // Prepend @PageableAsQueryParam to existing x-operation-extra-annotation if present diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/features/DocumentationProviderFeatures.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/features/DocumentationProviderFeatures.java index 43d3bbae8f03..cd0946a53b44 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/features/DocumentationProviderFeatures.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/features/DocumentationProviderFeatures.java @@ -74,9 +74,6 @@ enum DocumentationProvider { SWAGGER2("swagger2DocumentationProvider", "Generate an OpenAPI 3 specification using Swagger-Core 2.x.", AnnotationLibrary.SWAGGER2, AnnotationLibrary.SWAGGER2), - SPRINGFOX("springFoxDocumentationProvider", "Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.", - AnnotationLibrary.SWAGGER1, AnnotationLibrary.SWAGGER1), - SPRINGDOC("springDocDocumentationProvider", "Generate an OpenAPI 3 specification using SpringDoc.", AnnotationLibrary.SWAGGER2, AnnotationLibrary.SWAGGER2); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index ed3369a97aba..dc250555135b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -761,7 +761,8 @@ public void useTargetOnInterfaceAnnotationsWithSwagger1() throws IOException { KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); codegen.additionalProperties().put(ANNOTATION_LIBRARY, AnnotationLibrary.SWAGGER1.toCliOptValue()); - codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, DocumentationProvider.SPRINGFOX.toCliOptValue()); + codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, DocumentationProvider.NONE.toCliOptValue()); + new DefaultGenerator().opts(new ClientOptInput() .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml")) @@ -3260,20 +3261,6 @@ public Object[][] issue17997DocumentationProviders() { "allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable", "@PathVariable" ) - }, - { DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"0, 1\", defaultValue = \"0\"", - "@PathVariable" - ), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"sleeping, awake\"", "@PathVariable", - "@PathVariable" - ) } }; } @@ -3701,23 +3688,6 @@ public void springPaginatedWithSpringDocAndSpringBoot3() throws Exception { assertFileContains(petApi.toPath(), "pageable: Pageable"); } - @Test - public void springPaginatedWithSpringFox() throws Exception { - Map additionalProperties = new HashMap<>(); - additionalProperties.put(USE_TAGS, "true"); - additionalProperties.put(DOCUMENTATION_PROVIDER, "springfox"); - additionalProperties.put(INTERFACE_ONLY, "true"); - additionalProperties.put(SKIP_DEFAULT_INTERFACE, "true"); - - Map files = generateFromContract("src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml", additionalProperties); - - File petApi = files.get("PetApi.kt"); - assertFileContains(petApi.toPath(), "import org.springframework.data.domain.Pageable"); - assertFileContains(petApi.toPath(), "import springfox.documentation.annotations.ApiIgnore"); - assertFileContains(petApi.toPath(), "pageable: Pageable"); - assertFileContains(petApi.toPath(), "@ApiParam(hidden = true) pageable: Pageable"); - } - @Test public void springPaginatedQueryParamsRemoved() throws Exception { Map additionalProperties = new HashMap<>(); @@ -3845,24 +3815,6 @@ public void springPaginatedWithNoDocumentationProvider() throws Exception { assertFileNotContains(petApi.toPath(), "@ParameterObject pageable"); } - @Test - public void springPaginatedWithSwagger1AnnotationLibrary() throws Exception { - Map additionalProperties = new HashMap<>(); - additionalProperties.put(USE_TAGS, "true"); - additionalProperties.put(DOCUMENTATION_PROVIDER, "springfox"); - additionalProperties.put(ANNOTATION_LIBRARY, "swagger1"); - additionalProperties.put(INTERFACE_ONLY, "true"); - additionalProperties.put(SKIP_DEFAULT_INTERFACE, "true"); - - Map files = generateFromContract("src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml", additionalProperties); - - // Test with swagger1 annotations - File petApi = files.get("PetApi.kt"); - assertFileContains(petApi.toPath(), "import org.springframework.data.domain.Pageable"); - assertFileContains(petApi.toPath(), "import springfox.documentation.annotations.ApiIgnore"); - assertFileContains(petApi.toPath(), "@ApiParam(hidden = true) pageable: Pageable"); - } - @Test public void springPaginatedWithSpringDocUsesPageableAsQueryParam() throws Exception { Map additionalProperties = new HashMap<>(); diff --git a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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 diff --git a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES deleted file mode 100644 index b58d94c8bb28..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES +++ /dev/null @@ -1,31 +0,0 @@ -README.md -build.gradle.kts -gradle/wrapper/gradle-wrapper.jar -gradle/wrapper/gradle-wrapper.properties -gradlew -gradlew.bat -pom.xml -settings.gradle -src/main/kotlin/org/openapitools/Application.kt -src/main/kotlin/org/openapitools/HomeController.kt -src/main/kotlin/org/openapitools/SpringFoxConfiguration.kt -src/main/kotlin/org/openapitools/api/ApiUtil.kt -src/main/kotlin/org/openapitools/api/Exceptions.kt -src/main/kotlin/org/openapitools/api/PetApiController.kt -src/main/kotlin/org/openapitools/api/PetApiService.kt -src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/StoreApiController.kt -src/main/kotlin/org/openapitools/api/StoreApiService.kt -src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/UserApiController.kt -src/main/kotlin/org/openapitools/api/UserApiService.kt -src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt -src/main/kotlin/org/openapitools/model/Category.kt -src/main/kotlin/org/openapitools/model/ModelApiResponse.kt -src/main/kotlin/org/openapitools/model/Order.kt -src/main/kotlin/org/openapitools/model/Pet.kt -src/main/kotlin/org/openapitools/model/Tag.kt -src/main/kotlin/org/openapitools/model/User.kt -src/main/resources/application.yaml -src/main/resources/openapi.yaml -src/main/resources/static/swagger-ui.html diff --git a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/VERSION deleted file mode 100644 index 0610c66bc14f..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.21.0-SNAPSHOT diff --git a/samples/server/petstore/kotlin-springboot-springfox/README.md b/samples/server/petstore/kotlin-springboot-springfox/README.md deleted file mode 100644 index b6865a081135..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# 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/) diff --git a/samples/server/petstore/kotlin-springboot-springfox/build.gradle.kts b/samples/server/petstore/kotlin-springboot-springfox/build.gradle.kts deleted file mode 100644 index cad1242edc51..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/build.gradle.kts +++ /dev/null @@ -1,52 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.7") - } -} - -group = "org.openapitools" -version = "1.0.0" - -repositories { - mavenCentral() -} - -tasks.withType { - kotlinOptions.jvmTarget = "11" -} - -plugins { - val kotlinVersion = "1.9.25" - 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.6.7" - id("io.spring.dependency-management") version "1.0.11.RELEASE" -} - -dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("io.springfox:springfox-swagger2:2.9.2") - implementation("org.webjars:swagger-ui:4.10.3") - implementation("org.webjars:webjars-locator-core") - - implementation("com.google.code.findbugs:jsr305:3.0.2") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("org.springframework.data:spring-data-commons") - implementation("javax.validation:validation-api") - implementation("javax.annotation:javax.annotation-api:1.3.2") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") - testImplementation("org.springframework.boot:spring-boot-starter-test") { - exclude(module = "junit") - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e6441136f3d4..000000000000 Binary files a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 80187ac30432..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradlew b/samples/server/petstore/kotlin-springboot-springfox/gradlew deleted file mode 100644 index 9d0ce634cb11..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while -APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path -[ -h "$app_path" ] -do -ls=$( ls -ld "$app_path" ) -link=${ls#*' -> '} -case $link in #( -/*) app_path=$link ;; #( -*) app_path=$APP_HOME$link ;; -esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { -echo "$*" -} >&2 - -die () { -echo -echo "$*" -echo -exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( -CYGWIN* ) cygwin=true ;; #( -Darwin* ) darwin=true ;; #( -MSYS* | MINGW* ) msys=true ;; #( -NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then -if [ -x "$JAVA_HOME/jre/sh/java" ] ; then -# IBM's JDK on AIX uses strange locations for the executables -JAVACMD=$JAVA_HOME/jre/sh/java -else -JAVACMD=$JAVA_HOME/bin/java -fi -if [ ! -x "$JAVACMD" ] ; then -die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi -else -JAVACMD=java -if ! command -v java >/dev/null 2>&1 -then -die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then -case $MAX_FD in #( -max*) -# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. -# shellcheck disable=SC2039,SC3045 -MAX_FD=$( ulimit -H -n ) || -warn "Could not query maximum file descriptor limit" -esac -case $MAX_FD in #( -'' | soft) :;; #( -*) -# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. -# shellcheck disable=SC2039,SC3045 -ulimit -n "$MAX_FD" || -warn "Could not set maximum file descriptor limit to $MAX_FD" -esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then -APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) -CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - -JAVACMD=$( cygpath --unix "$JAVACMD" ) - -# Now convert the arguments - kludge to limit ourselves to /bin/sh -for arg do -if -case $arg in #( --*) false ;; # don't mess with options #( -/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath -[ -e "$t" ] ;; #( -*) false ;; -esac -then -arg=$( cygpath --path --ignore --mixed "$arg" ) -fi -# Roll the args list around exactly as many times as the number of -# args, so each arg winds up back in the position where it started, but -# possibly modified. -# -# NB: a `for` loop captures its iteration list before it begins, so -# changing the positional parameters here affects neither the number of -# iterations, nor the values presented in `arg`. -shift # remove old arg -set -- "$@" "$arg" # push replacement arg -done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ -"-Dorg.gradle.appname=$APP_BASE_NAME" \ --classpath "$CLASSPATH" \ -org.gradle.wrapper.GradleWrapperMain \ -"$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then -die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( -printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | -xargs -n1 | -sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | -tr '\n' ' ' -)" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat b/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat deleted file mode 100644 index 25da30dbdeee..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/server/petstore/kotlin-springboot-springfox/pom.xml b/samples/server/petstore/kotlin-springboot-springfox/pom.xml deleted file mode 100644 index 789f094be1c1..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ - - 4.0.0 - org.openapitools - openapi-spring - jar - openapi-spring - 1.0.0 - - 2.9.2 - 4.10.3 - 3.0.2 - 1.3.2 - 1.6.21 - - 1.6.21 - UTF-8 - - - org.springframework.boot - spring-boot-starter-parent - 2.7.15 - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - - kotlin-maven-plugin - org.jetbrains.kotlin - ${kotlin.version} - - - spring - - 11 - - - - compile - compile - - compile - - - - test-compile - test-compile - - test-compile - - - - - - org.jetbrains.kotlin - kotlin-maven-allopen - ${kotlin.version} - - - - - - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-reflect - ${kotlin.version} - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.data - spring-data-commons - - - - - - io.springfox - springfox-swagger2 - ${springfox-swagger2.version} - - - org.webjars - swagger-ui - ${swagger-ui.version} - - - org.webjars - webjars-locator-core - - - - - com.google.code.findbugs - jsr305 - ${findbugs-jsr305.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - com.fasterxml.jackson.module - jackson-module-kotlin - - - - javax.validation - validation-api - - - javax.annotation - javax.annotation-api - ${javax-annotation.version} - provided - - - org.jetbrains.kotlin - kotlin-test-junit5 - ${kotlin-test-junit5.version} - test - - - diff --git a/samples/server/petstore/kotlin-springboot-springfox/settings.gradle b/samples/server/petstore/kotlin-springboot-springfox/settings.gradle deleted file mode 100644 index 14844905cd40..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -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" diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/Application.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/Application.kt deleted file mode 100644 index 2fe6de62479e..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/Application.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools - -import org.springframework.boot.runApplication -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.context.annotation.ComponentScan - -@SpringBootApplication -@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) -class Application - -fun main(args: Array) { - runApplication(*args) -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/HomeController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/HomeController.kt deleted file mode 100644 index 66c001243665..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/HomeController.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools - -import org.springframework.context.annotation.Bean -import org.springframework.stereotype.Controller -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.ResponseBody -import org.springframework.web.bind.annotation.GetMapping - -/** - * Home redirection to OpenAPI api documentation - */ -@Controller -class HomeController { - private val apiDocsPath = "/v2/api-docs" - - @GetMapping(value = ["/swagger-config.yaml"], produces = ["text/plain"]) - @ResponseBody - fun swaggerConfig(): String = "url: $apiDocsPath\n" - - @RequestMapping("/") - fun index(): String = "redirect:swagger-ui.html" -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/SpringFoxConfiguration.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/SpringFoxConfiguration.kt deleted file mode 100644 index 786ceedd6764..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/SpringFoxConfiguration.kt +++ /dev/null @@ -1,64 +0,0 @@ -package org.openapitools - -import org.springframework.beans.factory.annotation.Value -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.web.util.UriComponentsBuilder -import springfox.documentation.builders.ApiInfoBuilder -import springfox.documentation.builders.RequestHandlerSelectors -import springfox.documentation.service.ApiInfo -import springfox.documentation.service.Contact -import springfox.documentation.spi.DocumentationType -import springfox.documentation.spring.web.paths.Paths -import springfox.documentation.spring.web.paths.RelativePathProvider -import springfox.documentation.spring.web.plugins.Docket -import springfox.documentation.swagger2.annotations.EnableSwagger2 -import javax.servlet.ServletContext - - -@javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"], comments = "Generator version: 7.21.0-SNAPSHOT") -@Configuration -@EnableSwagger2 -class SpringFoxConfiguration { - - fun apiInfo(): ApiInfo { - return ApiInfoBuilder() - .title("OpenAPI Petstore") - .description("This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.") - .license("Apache-2.0") - .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0.html") - .termsOfServiceUrl("") - .version("1.0.0") - .contact(Contact("", "", "")) - .build() - } - - @Bean - fun customImplementation(servletContext: ServletContext, @Value("\${openapi.openAPIPetstore.base-path:\${api.base-path:/v2}}") basePath: String): Docket { - return Docket(DocumentationType.SWAGGER_2) - .select() - .apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) - .build() - .pathProvider(BasePathAwareRelativePathProvider(servletContext, basePath)) - .directModelSubstitute(java.time.LocalDate::class.java, java.sql.Date::class.java) - .directModelSubstitute(java.time.OffsetDateTime::class.java, java.util.Date::class.java) - .apiInfo(apiInfo()) - } - - class BasePathAwareRelativePathProvider(servletContext: ServletContext, private val basePath: String) : - RelativePathProvider(servletContext) { - - override fun applicationPath(): String { - return Paths.removeAdjacentForwardSlashes( - UriComponentsBuilder.fromPath(super.applicationPath()).path(basePath).build().toString() - ) - } - - override fun getOperationPath(operationPath: String): String { - val uriComponentsBuilder = UriComponentsBuilder.fromPath("/") - return Paths.removeAdjacentForwardSlashes( - uriComponentsBuilder.path(operationPath.replaceFirst("^$basePath", "")).build().toString() - ) - } - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/ApiUtil.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/ApiUtil.kt deleted file mode 100644 index 88e892d0f49a..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/ApiUtil.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.api - -import org.springframework.web.context.request.NativeWebRequest - -import javax.servlet.http.HttpServletResponse -import java.io.IOException - -object ApiUtil { - fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { - try { - val res = req.getNativeResponse(HttpServletResponse::class.java) - res?.characterEncoding = "UTF-8" - res?.addHeader("Content-Type", contentType) - res?.writer?.print(example) - } catch (e: IOException) { - throw RuntimeException(e) - } - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/Exceptions.kt deleted file mode 100644 index 901db1237ee7..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/Exceptions.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapitools.api - -import org.springframework.context.annotation.Configuration -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.ControllerAdvice -import org.springframework.web.bind.annotation.ExceptionHandler -import javax.servlet.http.HttpServletResponse -import javax.validation.ConstraintViolationException - -// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception -sealed class ApiException(msg: String, val code: Int) : Exception(msg) - -class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) - -@Configuration("org.openapitools.api.DefaultExceptionHandler") -@ControllerAdvice -class DefaultExceptionHandler { - - @ExceptionHandler(value = [ApiException::class]) - fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = - response.sendError(ex.code, ex.message) - - @ExceptionHandler(value = [NotImplementedError::class]) - fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) - - @ExceptionHandler(value = [ConstraintViolationException::class]) - fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt deleted file mode 100644 index 528e299c7357..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ /dev/null @@ -1,224 +0,0 @@ -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.* -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.Email -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 - -@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( - method = [RequestMethod.POST], - // "/pet" - value = [PATH_ADD_PET], - consumes = ["application/json", "application/xml"] - ) - fun addPet( - @ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody body: Pet - ): ResponseEntity { - return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405)) - } - - - @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( - method = [RequestMethod.DELETE], - // "/pet/{petId}" - value = [PATH_DELETE_PET] - ) - fun deletePet( - @ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long, - @ApiParam(value = "") @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String? - ): ResponseEntity { - return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400)) - } - - - @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 = "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 = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) - @RequestMapping( - method = [RequestMethod.GET], - // "/pet/findByStatus" - value = [PATH_FIND_PETS_BY_STATUS], - produces = ["application/xml", "application/json"] - ) - 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: kotlin.collections.List - ): ResponseEntity> { - return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) - } - - - @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 = "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 = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) - @Deprecated(message="Operation is deprecated") - @RequestMapping( - method = [RequestMethod.GET], - // "/pet/findByTags" - value = [PATH_FIND_PETS_BY_TAGS], - produces = ["application/xml", "application/json"] - ) - fun findPetsByTags( - @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List - ): ResponseEntity> { - return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) - } - - - @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( - method = [RequestMethod.GET], - // "/pet/{petId}" - value = [PATH_GET_PET_BY_ID], - produces = ["application/xml", "application/json"] - ) - fun getPetById( - @ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long - ): ResponseEntity { - return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) - } - - - @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( - method = [RequestMethod.PUT], - // "/pet" - value = [PATH_UPDATE_PET], - consumes = ["application/json", "application/xml"] - ) - fun updatePet( - @ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody body: Pet - ): ResponseEntity { - return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400)) - } - - - @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( - method = [RequestMethod.POST], - // "/pet/{petId}" - value = [PATH_UPDATE_PET_WITH_FORM], - consumes = ["application/x-www-form-urlencoded"] - ) - fun updatePetWithForm( - @ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long, - @ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) name: kotlin.String?, - @ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) status: kotlin.String? - ): ResponseEntity { - return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405)) - } - - - @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( - method = [RequestMethod.POST], - // "/pet/{petId}/uploadImage" - value = [PATH_UPLOAD_FILE], - produces = ["application/json"], - consumes = ["multipart/form-data"] - ) - fun uploadFile( - @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String?, - @ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile - ): ResponseEntity { - return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) - } - - companion object { - //for your own safety never directly reuse these path definitions in tests - const val BASE_PATH: String = "/v2" - const val PATH_ADD_PET: String = "/pet" - const val PATH_DELETE_PET: String = "/pet/{petId}" - const val PATH_FIND_PETS_BY_STATUS: String = "/pet/findByStatus" - const val PATH_FIND_PETS_BY_TAGS: String = "/pet/findByTags" - const val PATH_GET_PET_BY_ID: String = "/pet/{petId}" - const val PATH_UPDATE_PET: String = "/pet" - const val PATH_UPDATE_PET_WITH_FORM: String = "/pet/{petId}" - const val PATH_UPLOAD_FILE: String = "/pet/{petId}/uploadImage" - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt deleted file mode 100644 index 566196d1e86d..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ /dev/null @@ -1,95 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.ModelApiResponse -import org.openapitools.model.Pet - -interface PetApiService { - - /** - * POST /pet : Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid input (status code 405) - * @see PetApi#addPet - */ - fun addPet(body: Pet): Unit - - /** - * DELETE /pet/{petId} : Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @return Invalid pet value (status code 400) - * @see PetApi#deletePet - */ - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit - - /** - * GET /pet/findByStatus : Finds Pets by status - * Multiple status values can be provided with comma separated strings - * - * @param status Status values that need to be considered for filter (required) - * @return successful operation (status code 200) - * or Invalid status value (status code 400) - * @see PetApi#findPetsByStatus - */ - fun findPetsByStatus(status: kotlin.collections.List): List - - /** - * GET /pet/findByTags : Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @param tags Tags to filter by (required) - * @return successful operation (status code 200) - * or Invalid tag value (status code 400) - * @deprecated - * @see PetApi#findPetsByTags - */ - @Deprecated(message="Operation is deprecated") - fun findPetsByTags(tags: kotlin.collections.List): List - - /** - * GET /pet/{petId} : Find pet by ID - * Returns a single pet - * - * @param petId ID of pet to return (required) - * @return successful operation (status code 200) - * or Invalid ID supplied (status code 400) - * or Pet not found (status code 404) - * @see PetApi#getPetById - */ - fun getPetById(petId: kotlin.Long): Pet - - /** - * PUT /pet : Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @return Invalid ID supplied (status code 400) - * or Pet not found (status code 404) - * or Validation exception (status code 405) - * @see PetApi#updatePet - */ - fun updatePet(body: Pet): Unit - - /** - * POST /pet/{petId} : Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return Invalid input (status code 405) - * @see PetApi#updatePetWithForm - */ - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit - - /** - * POST /pet/{petId}/uploadImage : uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return successful operation (status code 200) - * @see PetApi#uploadFile - */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile): ModelApiResponse -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt deleted file mode 100644 index a48482be32bd..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.ModelApiResponse -import org.openapitools.model.Pet -import org.springframework.stereotype.Service -@Service -class PetApiServiceImpl : PetApiService { - - override fun addPet(body: Pet): Unit { - TODO("Implement me") - } - - override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit { - TODO("Implement me") - } - - override fun findPetsByStatus(status: kotlin.collections.List): List { - TODO("Implement me") - } - - override fun findPetsByTags(tags: kotlin.collections.List): List { - TODO("Implement me") - } - - override fun getPetById(petId: kotlin.Long): Pet { - TODO("Implement me") - } - - override fun updatePet(body: Pet): Unit { - TODO("Implement me") - } - - override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit { - TODO("Implement me") - } - - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile): ModelApiResponse { - TODO("Implement me") - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt deleted file mode 100644 index 2fcff50b5a80..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ /dev/null @@ -1,125 +0,0 @@ -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.* -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.Email -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 - -@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( - method = [RequestMethod.DELETE], - // "/store/order/{orderId}" - value = [PATH_DELETE_ORDER] - ) - fun deleteOrder( - @ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") orderId: kotlin.String - ): ResponseEntity { - return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) - } - - - @ApiOperation( - value = "Returns pet inventories by status", - nickname = "getInventory", - notes = "Returns a map of status codes to quantities", - response = kotlin.Int::class, - responseContainer = "Map", - authorizations = [Authorization(value = "api_key")]) - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) - @RequestMapping( - method = [RequestMethod.GET], - // "/store/inventory" - value = [PATH_GET_INVENTORY], - produces = ["application/json"] - ) - fun getInventory(): ResponseEntity> { - return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Find purchase order by ID", - nickname = "getOrderById", - notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate 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( - method = [RequestMethod.GET], - // "/store/order/{orderId}" - value = [PATH_GET_ORDER_BY_ID], - produces = ["application/xml", "application/json"] - ) - fun getOrderById( - @Min(value=1L) @Max(value=5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long - ): ResponseEntity { - return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) - } - - - @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( - method = [RequestMethod.POST], - // "/store/order" - value = [PATH_PLACE_ORDER], - produces = ["application/xml", "application/json"] - ) - fun placeOrder( - @ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody body: Order - ): ResponseEntity { - return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200)) - } - - companion object { - //for your own safety never directly reuse these path definitions in tests - const val BASE_PATH: String = "/v2" - const val PATH_DELETE_ORDER: String = "/store/order/{orderId}" - const val PATH_GET_INVENTORY: String = "/store/inventory" - const val PATH_GET_ORDER_BY_ID: String = "/store/order/{orderId}" - const val PATH_PLACE_ORDER: String = "/store/order" - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiService.kt deleted file mode 100644 index 60e754529448..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.Order - -interface StoreApiService { - - /** - * DELETE /store/order/{orderId} : Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @param orderId ID of the order that needs to be deleted (required) - * @return Invalid ID supplied (status code 400) - * or Order not found (status code 404) - * @see StoreApi#deleteOrder - */ - fun deleteOrder(orderId: kotlin.String): Unit - - /** - * GET /store/inventory : Returns pet inventories by status - * Returns a map of status codes to quantities - * - * @return successful operation (status code 200) - * @see StoreApi#getInventory - */ - fun getInventory(): Map - - /** - * GET /store/order/{orderId} : Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * - * @param orderId ID of pet that needs to be fetched (required) - * @return successful operation (status code 200) - * or Invalid ID supplied (status code 400) - * or Order not found (status code 404) - * @see StoreApi#getOrderById - */ - fun getOrderById(orderId: kotlin.Long): Order - - /** - * POST /store/order : Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return successful operation (status code 200) - * or Invalid Order (status code 400) - * @see StoreApi#placeOrder - */ - fun placeOrder(body: Order): Order -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt deleted file mode 100644 index 7e733e28dc50..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.Order -import org.springframework.stereotype.Service -@Service -class StoreApiServiceImpl : StoreApiService { - - override fun deleteOrder(orderId: kotlin.String): Unit { - TODO("Implement me") - } - - override fun getInventory(): Map { - TODO("Implement me") - } - - override fun getOrderById(orderId: kotlin.Long): Order { - TODO("Implement me") - } - - override fun placeOrder(body: Order): Order { - TODO("Implement me") - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt deleted file mode 100644 index 14338953a646..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ /dev/null @@ -1,199 +0,0 @@ -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.* -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.Email -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 - -@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.") - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - method = [RequestMethod.POST], - // "/user" - value = [PATH_CREATE_USER] - ) - fun createUser( - @ApiParam(value = "Created user object", required = true) @Valid @RequestBody body: User - ): ResponseEntity { - return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Creates list of users with given input array", - nickname = "createUsersWithArrayInput", - notes = "") - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - method = [RequestMethod.POST], - // "/user/createWithArray" - value = [PATH_CREATE_USERS_WITH_ARRAY_INPUT] - ) - fun createUsersWithArrayInput( - @ApiParam(value = "List of user object", required = true) @Valid @RequestBody body: kotlin.collections.List - ): ResponseEntity { - return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Creates list of users with given input array", - nickname = "createUsersWithListInput", - notes = "") - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - method = [RequestMethod.POST], - // "/user/createWithList" - value = [PATH_CREATE_USERS_WITH_LIST_INPUT] - ) - fun createUsersWithListInput( - @ApiParam(value = "List of user object", required = true) @Valid @RequestBody body: kotlin.collections.List - ): ResponseEntity { - return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Delete user", - nickname = "deleteUser", - notes = "This can only be done by the logged in user.") - @ApiResponses( - value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - method = [RequestMethod.DELETE], - // "/user/{username}" - value = [PATH_DELETE_USER] - ) - fun deleteUser( - @ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") username: kotlin.String - ): ResponseEntity { - return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) - } - - - @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( - method = [RequestMethod.GET], - // "/user/{username}" - value = [PATH_GET_USER_BY_NAME], - produces = ["application/xml", "application/json"] - ) - fun getUserByName( - @ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") username: kotlin.String - ): ResponseEntity { - return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Logs user into the system", - nickname = "loginUser", - notes = "", - response = kotlin.String::class) - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) - @RequestMapping( - method = [RequestMethod.GET], - // "/user/login" - value = [PATH_LOGIN_USER], - produces = ["application/xml", "application/json"] - ) - fun loginUser( - @NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String, - @NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String - ): ResponseEntity { - return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Logs out current logged in user session", - nickname = "logoutUser", - notes = "") - @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - method = [RequestMethod.GET], - // "/user/logout" - value = [PATH_LOGOUT_USER] - ) - fun logoutUser(): ResponseEntity { - return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) - } - - - @ApiOperation( - value = "Updated user", - nickname = "updateUser", - notes = "This can only be done by the logged in user.") - @ApiResponses( - value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - method = [RequestMethod.PUT], - // "/user/{username}" - value = [PATH_UPDATE_USER] - ) - fun updateUser( - @ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") username: kotlin.String, - @ApiParam(value = "Updated user object", required = true) @Valid @RequestBody body: User - ): ResponseEntity { - return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400)) - } - - companion object { - //for your own safety never directly reuse these path definitions in tests - const val BASE_PATH: String = "/v2" - const val PATH_CREATE_USER: String = "/user" - const val PATH_CREATE_USERS_WITH_ARRAY_INPUT: String = "/user/createWithArray" - const val PATH_CREATE_USERS_WITH_LIST_INPUT: String = "/user/createWithList" - const val PATH_DELETE_USER: String = "/user/{username}" - const val PATH_GET_USER_BY_NAME: String = "/user/{username}" - const val PATH_LOGIN_USER: String = "/user/login" - const val PATH_LOGOUT_USER: String = "/user/logout" - const val PATH_UPDATE_USER: String = "/user/{username}" - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiService.kt deleted file mode 100644 index a1bcf6be237c..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ /dev/null @@ -1,87 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.User - -interface UserApiService { - - /** - * POST /user : Create user - * This can only be done by the logged in user. - * - * @param body Created user object (required) - * @return successful operation (status code 200) - * @see UserApi#createUser - */ - fun createUser(body: User): Unit - - /** - * POST /user/createWithArray : Creates list of users with given input array - * - * @param body List of user object (required) - * @return successful operation (status code 200) - * @see UserApi#createUsersWithArrayInput - */ - fun createUsersWithArrayInput(body: kotlin.collections.List): Unit - - /** - * POST /user/createWithList : Creates list of users with given input array - * - * @param body List of user object (required) - * @return successful operation (status code 200) - * @see UserApi#createUsersWithListInput - */ - fun createUsersWithListInput(body: kotlin.collections.List): Unit - - /** - * DELETE /user/{username} : Delete user - * This can only be done by the logged in user. - * - * @param username The name that needs to be deleted (required) - * @return Invalid username supplied (status code 400) - * or User not found (status code 404) - * @see UserApi#deleteUser - */ - fun deleteUser(username: kotlin.String): Unit - - /** - * GET /user/{username} : Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return successful operation (status code 200) - * or Invalid username supplied (status code 400) - * or User not found (status code 404) - * @see UserApi#getUserByName - */ - fun getUserByName(username: kotlin.String): User - - /** - * GET /user/login : Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return successful operation (status code 200) - * or Invalid username/password supplied (status code 400) - * @see UserApi#loginUser - */ - fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String - - /** - * GET /user/logout : Logs out current logged in user session - * - * @return successful operation (status code 200) - * @see UserApi#logoutUser - */ - fun logoutUser(): Unit - - /** - * PUT /user/{username} : Updated user - * This can only be done by the logged in user. - * - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @return Invalid user supplied (status code 400) - * or User not found (status code 404) - * @see UserApi#updateUser - */ - fun updateUser(username: kotlin.String, body: User): Unit -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt deleted file mode 100644 index ebd822220153..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.User -import org.springframework.stereotype.Service -@Service -class UserApiServiceImpl : UserApiService { - - override fun createUser(body: User): Unit { - TODO("Implement me") - } - - override fun createUsersWithArrayInput(body: kotlin.collections.List): Unit { - TODO("Implement me") - } - - override fun createUsersWithListInput(body: kotlin.collections.List): Unit { - TODO("Implement me") - } - - override fun deleteUser(username: kotlin.String): Unit { - TODO("Implement me") - } - - override fun getUserByName(username: kotlin.String): User { - TODO("Implement me") - } - - override fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { - TODO("Implement me") - } - - override fun logoutUser(): Unit { - TODO("Implement me") - } - - override fun updateUser(username: kotlin.String, body: User): Unit { - TODO("Implement me") - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt deleted file mode 100644 index 072095d92ad6..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt +++ /dev/null @@ -1,34 +0,0 @@ -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.Email -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 javax.validation.Valid -import io.swagger.annotations.ApiModelProperty - -/** - * A category for a pet - * @param id - * @param name - */ -data class Category( - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null -) : java.io.Serializable { - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt deleted file mode 100644 index 9a75259a855f..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -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.Email -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 javax.validation.Valid -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 = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("type") val type: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("message") val message: kotlin.String? = null -) : java.io.Serializable { - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt deleted file mode 100644 index 070d17372ab1..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt +++ /dev/null @@ -1,72 +0,0 @@ -package org.openapitools.model - -import java.util.Objects -import com.fasterxml.jackson.annotation.JsonCreator -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.Email -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 javax.validation.Valid -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 = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, - - @ApiModelProperty(example = "null", value = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false -) : java.io.Serializable { - - /** - * Order Status - * Values: placed,approved,delivered - */ - enum class Status(@get:JsonValue val value: kotlin.String) { - - placed("placed"), - approved("approved"), - delivered("delivered"); - - companion object { - @JvmStatic - @JsonCreator - fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Order'") - } - } - } - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt deleted file mode 100644 index d2d474e56026..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt +++ /dev/null @@ -1,76 +0,0 @@ -package org.openapitools.model - -import java.util.Objects -import com.fasterxml.jackson.annotation.JsonCreator -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.Email -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 javax.validation.Valid -import io.swagger.annotations.ApiModelProperty - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ -data class Pet( - - @ApiModelProperty(example = "doggie", required = true, value = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, - - @ApiModelProperty(example = "null", required = true, value = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, - - @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("category") val category: Category? = null, - - @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, - - @ApiModelProperty(example = "null", value = "pet status in the store") - @get:JsonProperty("status") val status: Pet.Status? = null -) : java.io.Serializable { - - /** - * pet status in the store - * Values: available,pending,sold - */ - enum class Status(@get:JsonValue val value: kotlin.String) { - - available("available"), - pending("pending"), - sold("sold"); - - companion object { - @JvmStatic - @JsonCreator - fun forValue(value: kotlin.String): Status { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") - } - } - } - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt deleted file mode 100644 index b9d3297258e1..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt +++ /dev/null @@ -1,34 +0,0 @@ -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.Email -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 javax.validation.Valid -import io.swagger.annotations.ApiModelProperty - -/** - * A tag for a pet - * @param id - * @param name - */ -data class Tag( - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null -) : java.io.Serializable { - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt deleted file mode 100644 index f33aedc5b388..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt +++ /dev/null @@ -1,58 +0,0 @@ -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.Email -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 javax.validation.Valid -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 = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("username") val username: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("email") val email: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("password") val password: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null -) : java.io.Serializable { - - companion object { - private const val serialVersionUID: kotlin.Long = 1 - } -} - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/application.yaml deleted file mode 100644 index 8e2ebcde976d..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/application.yaml +++ /dev/null @@ -1,10 +0,0 @@ -spring: - application: - name: openAPIPetstore - - jackson: - serialization: - WRITE_DATES_AS_TIMESTAMPS: false - -server: - port: 8080 diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/openapi.yaml b/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/openapi.yaml deleted file mode 100644 index c199cb612e2f..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/openapi.yaml +++ /dev/null @@ -1,769 +0,0 @@ -openapi: 3.0.1 -info: - description: "This is a sample server Petstore server. For this sample, you can\ - \ use the api key `special-key` to test the authorization filters." - license: - name: Apache-2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html - title: OpenAPI Petstore - version: 1.0.0 -servers: -- url: http://petstore.swagger.io/v2 -tags: -- description: Everything about your Pets - name: pet -- description: Access to Petstore orders - name: store -- description: Operations about user - name: user -paths: - /pet: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - application/xml: - schema: - $ref: "#/components/schemas/Pet" - description: Pet object that needs to be added to the store - required: true - responses: - "405": - content: {} - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - summary: Add a new pet to the store - tags: - - pet - x-codegen-request-body-name: body - put: - operationId: updatePet - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - application/xml: - schema: - $ref: "#/components/schemas/Pet" - description: Pet object that needs to be added to the store - required: true - responses: - "400": - content: {} - description: Invalid ID supplied - "404": - content: {} - description: Pet not found - "405": - content: {} - description: Validation exception - security: - - petstore_auth: - - write:pets - - read:pets - summary: Update an existing pet - tags: - - pet - x-codegen-request-body-name: body - /pet/findByStatus: - get: - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - description: Status values that need to be considered for filter - explode: false - in: query - name: status - required: true - schema: - items: - default: available - enum: - - available - - pending - - sold - type: string - type: array - style: form - responses: - "200": - content: - application/xml: - schema: - items: - $ref: "#/components/schemas/Pet" - type: array - application/json: - schema: - items: - $ref: "#/components/schemas/Pet" - type: array - description: successful operation - "400": - content: {} - description: Invalid status value - security: - - petstore_auth: - - write:pets - - read:pets - summary: Finds Pets by status - tags: - - pet - /pet/findByTags: - get: - deprecated: true - description: "Multiple tags can be provided with comma separated strings. Use\ - \ tag1, tag2, tag3 for testing." - operationId: findPetsByTags - parameters: - - description: Tags to filter by - explode: false - in: query - name: tags - required: true - schema: - items: - type: string - type: array - style: form - responses: - "200": - content: - application/xml: - schema: - items: - $ref: "#/components/schemas/Pet" - type: array - application/json: - schema: - items: - $ref: "#/components/schemas/Pet" - type: array - description: successful operation - "400": - content: {} - description: Invalid tag value - security: - - petstore_auth: - - write:pets - - read:pets - summary: Finds Pets by tags - tags: - - pet - /pet/{petId}: - delete: - operationId: deletePet - parameters: - - in: header - name: api_key - schema: - type: string - - description: Pet id to delete - in: path - name: petId - required: true - schema: - format: int64 - type: integer - responses: - "400": - content: {} - description: Invalid pet value - security: - - petstore_auth: - - write:pets - - read:pets - summary: Deletes a pet - tags: - - pet - get: - description: Returns a single pet - operationId: getPetById - parameters: - - description: ID of pet to return - in: path - name: petId - required: true - schema: - format: int64 - type: integer - responses: - "200": - content: - application/xml: - schema: - $ref: "#/components/schemas/Pet" - application/json: - schema: - $ref: "#/components/schemas/Pet" - description: successful operation - "400": - content: {} - description: Invalid ID supplied - "404": - content: {} - description: Pet not found - security: - - api_key: [] - summary: Find pet by ID - tags: - - pet - post: - operationId: updatePetWithForm - parameters: - - description: ID of pet that needs to be updated - in: path - name: petId - required: true - schema: - format: int64 - type: integer - requestBody: - content: - application/x-www-form-urlencoded: - schema: - $ref: "#/components/schemas/updatePetWithForm_request" - responses: - "405": - content: {} - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - summary: Updates a pet in the store with form data - tags: - - pet - /pet/{petId}/uploadImage: - post: - operationId: uploadFile - parameters: - - description: ID of pet to update - in: path - name: petId - required: true - schema: - format: int64 - type: integer - requestBody: - content: - multipart/form-data: - schema: - $ref: "#/components/schemas/uploadFile_request" - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/ApiResponse" - description: successful operation - security: - - petstore_auth: - - write:pets - - read:pets - summary: uploads an image - tags: - - pet - /store/inventory: - get: - description: Returns a map of status codes to quantities - operationId: getInventory - responses: - "200": - content: - application/json: - schema: - additionalProperties: - format: int32 - type: integer - type: object - description: successful operation - security: - - api_key: [] - summary: Returns pet inventories by status - tags: - - store - /store/order: - post: - operationId: placeOrder - requestBody: - content: - '*/*': - schema: - $ref: "#/components/schemas/Order" - description: order placed for purchasing the pet - required: true - responses: - "200": - content: - application/xml: - schema: - $ref: "#/components/schemas/Order" - application/json: - schema: - $ref: "#/components/schemas/Order" - description: successful operation - "400": - content: {} - description: Invalid Order - summary: Place an order for a pet - tags: - - store - x-codegen-request-body-name: body - /store/order/{orderId}: - delete: - description: For valid response try integer IDs with value < 1000. Anything - above 1000 or nonintegers will generate API errors - operationId: deleteOrder - parameters: - - description: ID of the order that needs to be deleted - in: path - name: orderId - required: true - schema: - type: string - responses: - "400": - content: {} - description: Invalid ID supplied - "404": - content: {} - description: Order not found - summary: Delete purchase order by ID - tags: - - store - get: - description: For valid response try integer IDs with value <= 5 or > 10. Other - values will generate exceptions - operationId: getOrderById - parameters: - - description: ID of pet that needs to be fetched - in: path - name: orderId - required: true - schema: - format: int64 - maximum: 5 - minimum: 1 - type: integer - responses: - "200": - content: - application/xml: - schema: - $ref: "#/components/schemas/Order" - application/json: - schema: - $ref: "#/components/schemas/Order" - description: successful operation - "400": - content: {} - description: Invalid ID supplied - "404": - content: {} - description: Order not found - summary: Find purchase order by ID - tags: - - store - /user: - post: - description: This can only be done by the logged in user. - operationId: createUser - requestBody: - content: - '*/*': - schema: - $ref: "#/components/schemas/User" - description: Created user object - required: true - responses: - default: - content: {} - description: successful operation - summary: Create user - tags: - - user - x-codegen-request-body-name: body - /user/createWithArray: - post: - operationId: createUsersWithArrayInput - requestBody: - content: - '*/*': - schema: - items: - $ref: "#/components/schemas/User" - type: array - description: List of user object - required: true - responses: - default: - content: {} - description: successful operation - summary: Creates list of users with given input array - tags: - - user - x-codegen-request-body-name: body - /user/createWithList: - post: - operationId: createUsersWithListInput - requestBody: - content: - '*/*': - schema: - items: - $ref: "#/components/schemas/User" - type: array - description: List of user object - required: true - responses: - default: - content: {} - description: successful operation - summary: Creates list of users with given input array - tags: - - user - x-codegen-request-body-name: body - /user/login: - get: - operationId: loginUser - parameters: - - description: The user name for login - in: query - name: username - required: true - schema: - type: string - - description: The password for login in clear text - in: query - name: password - required: true - schema: - type: string - responses: - "200": - content: - application/xml: - schema: - type: string - application/json: - schema: - type: string - description: successful operation - headers: - X-Rate-Limit: - description: calls per hour allowed by the user - schema: - format: int32 - type: integer - X-Expires-After: - description: date in UTC when token expires - schema: - format: date-time - type: string - "400": - content: {} - description: Invalid username/password supplied - summary: Logs user into the system - tags: - - user - /user/logout: - get: - operationId: logoutUser - responses: - default: - content: {} - description: successful operation - summary: Logs out current logged in user session - tags: - - user - /user/{username}: - delete: - description: This can only be done by the logged in user. - operationId: deleteUser - parameters: - - description: The name that needs to be deleted - in: path - name: username - required: true - schema: - type: string - responses: - "400": - content: {} - description: Invalid username supplied - "404": - content: {} - description: User not found - summary: Delete user - tags: - - user - get: - operationId: getUserByName - parameters: - - description: The name that needs to be fetched. Use user1 for testing. - in: path - name: username - required: true - schema: - type: string - responses: - "200": - content: - application/xml: - schema: - $ref: "#/components/schemas/User" - application/json: - schema: - $ref: "#/components/schemas/User" - description: successful operation - "400": - content: {} - description: Invalid username supplied - "404": - content: {} - description: User not found - summary: Get user by user name - tags: - - user - put: - description: This can only be done by the logged in user. - operationId: updateUser - parameters: - - description: name that need to be deleted - in: path - name: username - required: true - schema: - type: string - requestBody: - content: - '*/*': - schema: - $ref: "#/components/schemas/User" - description: Updated user object - required: true - responses: - "400": - content: {} - description: Invalid user supplied - "404": - content: {} - description: User not found - summary: Updated user - tags: - - user - x-codegen-request-body-name: body -components: - schemas: - Order: - description: An order for a pets from the pet store - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed - properties: - id: - format: int64 - type: integer - petId: - format: int64 - type: integer - quantity: - format: int32 - type: integer - shipDate: - format: date-time - type: string - status: - description: Order Status - enum: - - placed - - approved - - delivered - type: string - complete: - default: false - type: boolean - title: Pet Order - type: object - xml: - name: Order - Category: - description: A category for a pet - example: - name: name - id: 6 - properties: - id: - format: int64 - type: integer - name: - type: string - title: Pet category - type: object - xml: - name: Category - User: - description: A User who is purchasing from the pet store - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username - properties: - id: - format: int64 - type: integer - username: - type: string - firstName: - type: string - lastName: - type: string - email: - type: string - password: - type: string - phone: - type: string - userStatus: - description: User Status - format: int32 - type: integer - title: a User - type: object - xml: - name: User - Tag: - description: A tag for a pet - example: - name: name - id: 1 - properties: - id: - format: int64 - type: integer - name: - type: string - title: Pet Tag - type: object - xml: - name: Tag - Pet: - description: A pet for sale in the pet store - example: - photoUrls: - - photoUrls - - photoUrls - name: doggie - id: 0 - category: - name: name - id: 6 - tags: - - name: name - id: 1 - - name: name - id: 1 - status: available - properties: - id: - format: int64 - type: integer - category: - $ref: "#/components/schemas/Category" - name: - example: doggie - type: string - photoUrls: - items: - type: string - type: array - xml: - name: photoUrl - wrapped: true - tags: - items: - $ref: "#/components/schemas/Tag" - type: array - xml: - name: tag - wrapped: true - status: - description: pet status in the store - enum: - - available - - pending - - sold - type: string - required: - - name - - photoUrls - title: a Pet - type: object - xml: - name: Pet - ApiResponse: - description: Describes the result of uploading an image resource - example: - code: 0 - type: type - message: message - properties: - code: - format: int32 - type: integer - type: - type: string - message: - type: string - title: An uploaded response - type: object - updatePetWithForm_request: - properties: - name: - description: Updated name of the pet - type: string - status: - description: Updated status of the pet - type: string - type: object - uploadFile_request: - properties: - additionalMetadata: - description: Additional data to pass to server - type: string - file: - description: file to upload - format: binary - type: string - type: object - securitySchemes: - petstore_auth: - flows: - implicit: - authorizationUrl: http://petstore.swagger.io/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets - type: oauth2 - api_key: - in: header - name: api_key - type: apiKey -x-original-swagger-version: "2.0" diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/static/swagger-ui.html b/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/static/swagger-ui.html deleted file mode 100644 index f85b6654f67d..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/resources/static/swagger-ui.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - Swagger UI - - - - - - - -
- - - - - - diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/PetApiTest.kt deleted file mode 100644 index 4ee3b320cc3e..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/PetApiTest.kt +++ /dev/null @@ -1,129 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.ModelApiResponse -import org.openapitools.model.Pet -import org.junit.jupiter.api.Test -import org.springframework.http.ResponseEntity - -class PetApiTest { - - private val service: PetApiService = PetApiServiceImpl() - private val api: PetApiController = PetApiController(service) - - /** - * To test PetApiController.addPet - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun addPetTest() { - val body: Pet = TODO() - val response: ResponseEntity = api.addPet(body) - - // TODO: test validations - } - - /** - * To test PetApiController.deletePet - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun deletePetTest() { - val petId: kotlin.Long = TODO() - val apiKey: kotlin.String? = TODO() - val response: ResponseEntity = api.deletePet(petId, apiKey) - - // TODO: test validations - } - - /** - * To test PetApiController.findPetsByStatus - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun findPetsByStatusTest() { - val status: kotlin.collections.List = TODO() - val response: ResponseEntity> = api.findPetsByStatus(status) - - // TODO: test validations - } - - /** - * To test PetApiController.findPetsByTags - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun findPetsByTagsTest() { - val tags: kotlin.collections.List = TODO() - val response: ResponseEntity> = api.findPetsByTags(tags) - - // TODO: test validations - } - - /** - * To test PetApiController.getPetById - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun getPetByIdTest() { - val petId: kotlin.Long = TODO() - val response: ResponseEntity = api.getPetById(petId) - - // TODO: test validations - } - - /** - * To test PetApiController.updatePet - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun updatePetTest() { - val body: Pet = TODO() - val response: ResponseEntity = api.updatePet(body) - - // TODO: test validations - } - - /** - * To test PetApiController.updatePetWithForm - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun updatePetWithFormTest() { - val petId: kotlin.Long = TODO() - val name: kotlin.String? = TODO() - val status: kotlin.String? = TODO() - val response: ResponseEntity = api.updatePetWithForm(petId, name, status) - - // TODO: test validations - } - - /** - * To test PetApiController.uploadFile - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun uploadFileTest() { - val petId: kotlin.Long = TODO() - val additionalMetadata: kotlin.String? = TODO() - val file: org.springframework.web.multipart.MultipartFile? = TODO() - val response: ResponseEntity = api.uploadFile(petId, additionalMetadata, file) - - // TODO: test validations - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/StoreApiTest.kt deleted file mode 100644 index 69e269b03ef1..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/StoreApiTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.Order -import org.junit.jupiter.api.Test -import org.springframework.http.ResponseEntity - -class StoreApiTest { - - private val service: StoreApiService = StoreApiServiceImpl() - private val api: StoreApiController = StoreApiController(service) - - /** - * To test StoreApiController.deleteOrder - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun deleteOrderTest() { - val orderId: kotlin.String = TODO() - val response: ResponseEntity = api.deleteOrder(orderId) - - // TODO: test validations - } - - /** - * To test StoreApiController.getInventory - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun getInventoryTest() { - val response: ResponseEntity> = api.getInventory() - - // TODO: test validations - } - - /** - * To test StoreApiController.getOrderById - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun getOrderByIdTest() { - val orderId: kotlin.Long = TODO() - val response: ResponseEntity = api.getOrderById(orderId) - - // TODO: test validations - } - - /** - * To test StoreApiController.placeOrder - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun placeOrderTest() { - val body: Order = TODO() - val response: ResponseEntity = api.placeOrder(body) - - // TODO: test validations - } -} diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/UserApiTest.kt deleted file mode 100644 index eb20423da71c..000000000000 --- a/samples/server/petstore/kotlin-springboot-springfox/src/test/kotlin/org/openapitools/api/UserApiTest.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.User -import org.junit.jupiter.api.Test -import org.springframework.http.ResponseEntity - -class UserApiTest { - - private val service: UserApiService = UserApiServiceImpl() - private val api: UserApiController = UserApiController(service) - - /** - * To test UserApiController.createUser - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun createUserTest() { - val body: User = TODO() - val response: ResponseEntity = api.createUser(body) - - // TODO: test validations - } - - /** - * To test UserApiController.createUsersWithArrayInput - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun createUsersWithArrayInputTest() { - val body: kotlin.collections.List = TODO() - val response: ResponseEntity = api.createUsersWithArrayInput(body) - - // TODO: test validations - } - - /** - * To test UserApiController.createUsersWithListInput - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun createUsersWithListInputTest() { - val body: kotlin.collections.List = TODO() - val response: ResponseEntity = api.createUsersWithListInput(body) - - // TODO: test validations - } - - /** - * To test UserApiController.deleteUser - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun deleteUserTest() { - val username: kotlin.String = TODO() - val response: ResponseEntity = api.deleteUser(username) - - // TODO: test validations - } - - /** - * To test UserApiController.getUserByName - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun getUserByNameTest() { - val username: kotlin.String = TODO() - val response: ResponseEntity = api.getUserByName(username) - - // TODO: test validations - } - - /** - * To test UserApiController.loginUser - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun loginUserTest() { - val username: kotlin.String = TODO() - val password: kotlin.String = TODO() - val response: ResponseEntity = api.loginUser(username, password) - - // TODO: test validations - } - - /** - * To test UserApiController.logoutUser - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun logoutUserTest() { - val response: ResponseEntity = api.logoutUser() - - // TODO: test validations - } - - /** - * To test UserApiController.updateUser - * - * @throws ApiException - * if the Api call fails - */ - @Test - fun updateUserTest() { - val username: kotlin.String = TODO() - val body: User = TODO() - val response: ResponseEntity = api.updateUser(username, body) - - // TODO: test validations - } -}