mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 10:35:25 +00:00
[kotlin-client][kotlin-server] Feature/kotlin data class serial version uid (#4021)
* feat: add companion object to data classes if the implement the interface java.io.Serializable * style: format template file * style: adapt to project's original code style * fix: add missing imports * style: reverted mustache template to original styling * test: generate additional samples for kotlin-springboot-reactive and kotlin-springboot * docs: name full qualified classname of interface java.io.Serializable to prevent confusion with kotlinx.serialization
This commit is contained in:
parent
cf38c56aa6
commit
bbfcd3bf64
@ -16,7 +16,7 @@ sidebar_label: kotlin-server
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements java.io.Serializable" for generated models| |null|
|
||||
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dl>|ktor|
|
||||
|featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true|
|
||||
|featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false|
|
||||
|
@ -16,4 +16,4 @@ sidebar_label: kotlin-vertx
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements java.io.Serializable" for generated models| |null|
|
||||
|
@ -16,7 +16,7 @@ sidebar_label: kotlin
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements java.io.Serializable" for generated models| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only)</dd><dt>**threetenbp**</dt><dd>Threetenbp (jvm only)</dd><dl>|java8|
|
||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd><dl>|array|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd><dl>|jvm|
|
||||
|
@ -248,6 +248,9 @@ public class CodegenConstants {
|
||||
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
|
||||
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS_DESC = "Make API response's headers case-insensitive";
|
||||
|
||||
public static final String NEEDS_DATACLASS_BODY = "needsDataClassBody";
|
||||
public static final String NEEDS_DATACLASS_BODY_DESC = "Specifies if the kotlin data class needs a body with curly braces or not.";
|
||||
|
||||
// Not user-configurable. System provided for use in templates.
|
||||
|
||||
public static final String GENERATE_APIS = "generateApis";
|
||||
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -31,12 +32,14 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson'";
|
||||
|
||||
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson}
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
@ -53,8 +56,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected boolean parcelizeModels = false;
|
||||
|
||||
protected boolean serializableModel = false;
|
||||
protected boolean needsDataClassBody = false;
|
||||
protected boolean hasEnums = false;
|
||||
|
||||
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
|
||||
protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi;
|
||||
@ -426,6 +430,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
additionalProperties.put(CodegenConstants.PARCELIZE_MODELS, parcelizeModels);
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.NEEDS_DATACLASS_BODY, this.hasEnums || serializableModel);
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage());
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage());
|
||||
|
||||
@ -476,6 +481,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
public void setSerializableModel(boolean serializableModel) {
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
public boolean isNeedsDataClassBody() {
|
||||
return needsDataClassBody;
|
||||
}
|
||||
|
||||
public void setNeedsDataClassBody(boolean needsDataClassBody) {
|
||||
this.needsDataClassBody = needsDataClassBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sanitized variable name for enum
|
||||
*
|
||||
@ -746,6 +760,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
return imports;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
CodegenModel m = super.fromModel(name, schema);
|
||||
m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList());
|
||||
m.allVars.stream().filter(p -> !m.vars.contains(p)).forEach(p -> p.isInherited = true);
|
||||
this.hasEnums = m.hasEnums;
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("kotlin.Int".equals(datatype) || "kotlin.Long".equals(datatype)) {
|
||||
|
@ -37,8 +37,12 @@ data class {{classname}} (
|
||||
) {{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}
|
||||
{{^parcelizeModels}}{{#serializableModel}}: Serializable {{/serializableModel}}{{/parcelizeModels}}
|
||||
{{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}}
|
||||
{{#hasEnums}}
|
||||
{
|
||||
{{#needsDataClassBody}}{{=<% %>=}}{<%={{ }}=%>{{/needsDataClassBody}}
|
||||
{{#serializableModel}}
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
{{/serializableModel}}{{#hasEnums}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
* {{{description}}}
|
||||
@ -65,5 +69,4 @@ data class {{classname}} (
|
||||
{{/multiplatform}}
|
||||
}
|
||||
{{/isEnum}}{{/vars}}
|
||||
}
|
||||
{{/hasEnums}}
|
||||
{{/hasEnums}}{{#needsDataClassBody}}{{=<% %>=}}}<%={{ }}=%>{{/needsDataClassBody}}
|
||||
|
@ -21,11 +21,15 @@ data class {{classname}} (
|
||||
{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}},
|
||||
{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}},
|
||||
{{/-last}}{{/optionalVars}}
|
||||
) {{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}
|
||||
{{^parcelizeModels}}{{#serializableModel}}: Serializable {{/serializableModel}}{{/parcelizeModels}}
|
||||
{{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}}
|
||||
{
|
||||
{{#hasEnums}}{{#vars}}{{#isEnum}}
|
||||
) {{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}{{^parcelizeModels}}{{#serializableModel}}: Serializable {{/serializableModel}}{{/parcelizeModels}}{{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}}
|
||||
{{#needsDataClassBody}}{{=<% %>=}}{<%={{ }}=%>{{/needsDataClassBody}}
|
||||
{{#serializableModel}}
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
{{/serializableModel}}
|
||||
{{#hasEnums}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
* {{{description}}}
|
||||
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
@ -35,5 +39,4 @@ data class {{classname}} (
|
||||
{{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}{{/vars}}{{/hasEnums}}
|
||||
}
|
||||
{{/isEnum}}{{/vars}}{{/hasEnums}}{{#needsDataClassBody}}{{=<% %>=}}}<%={{ }}=%>{{/needsDataClassBody}}
|
||||
|
@ -29,3 +29,5 @@ data class ApiResponse (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -27,3 +27,5 @@ data class Category (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -35,7 +35,8 @@ data class Order (
|
||||
)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
@ -54,5 +55,5 @@ data class Order (
|
||||
object Serializer : CommonEnumSerializer<Status>("Status", values(), values().map { it.value }.toTypedArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,7 +37,8 @@ data class Pet (
|
||||
)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
@ -56,5 +57,5 @@ data class Pet (
|
||||
object Serializer : CommonEnumSerializer<Status>("Status", values(), values().map { it.value }.toTypedArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,3 +27,5 @@ data class Tag (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -40,3 +40,5 @@ data class User (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -31,4 +31,9 @@ data class ApiResponse (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Category (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ data class Order (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
|
@ -44,6 +44,10 @@ data class Pet (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
|
@ -28,4 +28,9 @@ data class Tag (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,9 @@ data class User (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,3 +31,5 @@ data class ApiResponse (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -28,3 +28,5 @@ data class Category (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -40,7 +40,8 @@ data class Order (
|
||||
)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
@ -58,5 +59,5 @@ data class Order (
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,8 @@ data class Pet (
|
||||
)
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
@ -60,5 +61,5 @@ data class Pet (
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,3 +28,5 @@ data class Tag (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -47,3 +47,5 @@ data class User (
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -31,4 +31,9 @@ data class ApiResponse (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Category (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ data class Order (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
|
@ -44,6 +44,10 @@ data class Pet (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
|
@ -28,4 +28,9 @@ data class Tag (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,9 @@ data class User (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
5.0.0-SNAPSHOT
|
||||
4.1.3-SNAPSHOT
|
@ -28,4 +28,9 @@ data class AdditionalPropertiesClass (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Animal (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,4 +31,9 @@ data class ApiResponse (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class ArrayOfArrayOfNumberOnly (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class ArrayOfNumberOnly (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,4 +32,9 @@ data class ArrayTest (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,4 +41,9 @@ data class Capitalization (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,4 +31,9 @@ data class Cat (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class CatAllOf (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Category (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class ClassModel (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class Client (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,4 +31,9 @@ data class Dog (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class DogAllOf (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,10 @@ data class EnumArrays (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,6 +51,10 @@ data class EnumTest (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,4 +28,9 @@ data class FileSchemaTestClass (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class Foo (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,4 +69,9 @@ data class FormatTest (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class HasOnlyReadOnly (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class HealthCheckResult (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,9 @@ data class InlineObject (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,9 @@ data class InlineObject1 (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,10 @@ data class InlineObject2 (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Form parameter enum test (string array)
|
||||
|
@ -78,4 +78,9 @@ data class InlineObject3 (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,9 @@ data class InlineObject4 (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,9 @@ data class InlineObject5 (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,9 @@ data class InlineResponseDefault (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,18 @@ import com.squareup.moshi.Json
|
||||
import java.io.Serializable
|
||||
/**
|
||||
*
|
||||
* @param ``123minusList``
|
||||
* @param `123minusList`
|
||||
*/
|
||||
|
||||
data class List (
|
||||
@Json(name = "123-list")
|
||||
val ``123minusList``: kotlin.String? = null
|
||||
val `123minusList`: kotlin.String? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,10 @@ data class MapTest (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -32,4 +32,9 @@ data class MixedPropertiesAndAdditionalPropertiesClass (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Model200Response (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ import java.io.Serializable
|
||||
* @param name
|
||||
* @param snakeCase
|
||||
* @param property
|
||||
* @param ``123number``
|
||||
* @param `123number`
|
||||
*/
|
||||
|
||||
data class Name (
|
||||
@ -30,8 +30,13 @@ data class Name (
|
||||
@Json(name = "property")
|
||||
val property: kotlin.String? = null,
|
||||
@Json(name = "123Number")
|
||||
val ``123number``: kotlin.Int? = null
|
||||
val `123number`: kotlin.Int? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,4 +58,9 @@ data class NullableClass (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class NumberOnly (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ data class Order (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
|
@ -31,4 +31,9 @@ data class OuterComposite (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,10 @@ data class Pet (
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
|
@ -28,4 +28,9 @@ data class ReadOnlyFirst (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,18 @@ import com.squareup.moshi.Json
|
||||
import java.io.Serializable
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
* @param ``return``
|
||||
* @param `return`
|
||||
*/
|
||||
|
||||
data class Return (
|
||||
@Json(name = "return")
|
||||
val ``return``: kotlin.Int? = null
|
||||
val `return`: kotlin.Int? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,9 @@ data class SpecialModelname (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,9 @@ data class Tag (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,9 @@ data class User (
|
||||
)
|
||||
: Serializable
|
||||
|
||||
{
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
4.0.1-SNAPSHOT
|
||||
4.1.3-SNAPSHOT
|
@ -43,9 +43,11 @@ dependencies {
|
||||
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
|
||||
testCompile("org.jetbrains.kotlin:kotlin-test-junit5")
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||
exclude(module = "junit")
|
||||
}
|
||||
testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion")
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -96,6 +96,12 @@
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
@ -117,6 +123,12 @@
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test-junit5</artifactId>
|
||||
<version>1.3.31</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -45,142 +45,141 @@ import kotlin.collections.Map
|
||||
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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.OK)
|
||||
return ResponseEntity(service.addPet(pet), 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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid pet value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend 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<Unit> {
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
||||
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 = "read:pets", description = "read your pets")])])
|
||||
value = "Finds Pets by status",
|
||||
nickname = "findPetsByStatus",
|
||||
notes = "Multiple status values can be provided with comma separated strings",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List<String>
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>
|
||||
): ResponseEntity<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
||||
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 = "read:pets", description = "read your pets")])])
|
||||
value = "Finds Pets by tags",
|
||||
nickname = "findPetsByTags",
|
||||
notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List<String>
|
||||
,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int?
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>
|
||||
): ResponseEntity<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK)
|
||||
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")])
|
||||
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")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
||||
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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.OK)
|
||||
return ResponseEntity(service.updatePet(pet), 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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
||||
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")])])
|
||||
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)])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}/uploadImage"],
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
|
||||
value = ["/pet/{petId}/uploadImage"],
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String?
|
||||
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
||||
): ResponseEntity<ModelApiResponse> {
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
|
||||
}
|
||||
}
|
||||
|
@ -7,17 +7,17 @@ interface PetApiService {
|
||||
|
||||
suspend fun addPet(pet: Pet): Unit
|
||||
|
||||
suspend fun deletePet(petId: Long, apiKey: String?): Unit
|
||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
|
||||
|
||||
fun findPetsByStatus(status: List<String>): Flow<Pet>
|
||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||
|
||||
fun findPetsByTags(tags: List<String>, maxCount: Int?): Flow<Pet>
|
||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||
|
||||
suspend fun getPetById(petId: Long): Pet
|
||||
suspend fun getPetById(petId: kotlin.Long): Pet
|
||||
|
||||
suspend fun updatePet(pet: Pet): Unit
|
||||
|
||||
suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
|
||||
|
||||
suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
}
|
||||
|
@ -11,19 +11,19 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deletePet(petId: Long, apiKey: String?): Unit {
|
||||
override suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByStatus(status: List<String>): Flow<Pet> {
|
||||
override fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByTags(tags: List<String>, maxCount: Int?): Flow<Pet> {
|
||||
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getPetById(petId: Long): Pet {
|
||||
override suspend fun getPetById(petId: kotlin.Long): Pet {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@ -31,11 +31,11 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
||||
override suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
@ -44,66 +44,66 @@ import kotlin.collections.Map
|
||||
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")
|
||||
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")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
|
||||
value = ["/store/order/{orderId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
|
||||
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 = Int::class,
|
||||
responseContainer = "Map",
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
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 = Map::class, responseContainer = "Map")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")])
|
||||
@RequestMapping(
|
||||
value = ["/store/inventory"],
|
||||
produces = ["application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getInventory(): ResponseEntity<Map<String, Int>> {
|
||||
return ResponseEntity(service.getInventory(), HttpStatus.OK)
|
||||
value = ["/store/inventory"],
|
||||
produces = ["application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getInventory(): ResponseEntity<Map<String, kotlin.Int>> {
|
||||
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 generated exceptions",
|
||||
response = Order::class)
|
||||
value = "Find purchase order by ID",
|
||||
nickname = "getOrderById",
|
||||
notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||
response = Order::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long
|
||||
value = ["/store/order/{orderId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK)
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Place an order for a pet",
|
||||
nickname = "placeOrder",
|
||||
notes = "",
|
||||
response = Order::class)
|
||||
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")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")])
|
||||
@RequestMapping(
|
||||
value = ["/store/order"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/store/order"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.placeOrder(order), HttpStatus.OK)
|
||||
return ResponseEntity(service.placeOrder(order), HttpStatus.valueOf(200))
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ import org.openapitools.model.Order
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface StoreApiService {
|
||||
|
||||
suspend fun deleteOrder(orderId: String): Unit
|
||||
suspend fun deleteOrder(orderId: kotlin.String): Unit
|
||||
|
||||
suspend fun getInventory(): Map<String, Int>
|
||||
suspend fun getInventory(): Map<String, kotlin.Int>
|
||||
|
||||
suspend fun getOrderById(orderId: Long): Order
|
||||
suspend fun getOrderById(orderId: kotlin.Long): Order
|
||||
|
||||
suspend fun placeOrder(order: Order): Order
|
||||
}
|
||||
|
@ -6,15 +6,15 @@ import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class StoreApiServiceImpl : StoreApiService {
|
||||
|
||||
override suspend fun deleteOrder(orderId: String): Unit {
|
||||
override suspend fun deleteOrder(orderId: kotlin.String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getInventory(): Map<String, Int> {
|
||||
override suspend fun getInventory(): Map<String, kotlin.Int> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getOrderById(orderId: Long): Order {
|
||||
override suspend fun getOrderById(orderId: kotlin.Long): Order {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
|
@ -44,129 +44,129 @@ import kotlin.collections.Map
|
||||
class UserApiController(@Autowired(required = true) val service: UserApiService) {
|
||||
|
||||
@ApiOperation(
|
||||
value = "Create user",
|
||||
nickname = "createUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Create user",
|
||||
nickname = "createUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/user"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUser(user), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUser(user), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithArrayInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithArrayInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/createWithArray"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/user/createWithArray"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithListInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithListInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/createWithList"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/user/createWithList"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Delete user",
|
||||
nickname = "deleteUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Delete user",
|
||||
nickname = "deleteUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK)
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Get user by user name",
|
||||
nickname = "getUserByName",
|
||||
notes = "",
|
||||
response = User::class)
|
||||
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")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String
|
||||
value = ["/user/{username}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String
|
||||
): ResponseEntity<User> {
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK)
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Logs user into the system",
|
||||
nickname = "loginUser",
|
||||
notes = "",
|
||||
response = String::class)
|
||||
value = "Logs user into the system",
|
||||
nickname = "loginUser",
|
||||
notes = "",
|
||||
response = kotlin.String::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||
@RequestMapping(
|
||||
value = ["/user/login"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String
|
||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String
|
||||
): ResponseEntity<String> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK)
|
||||
value = ["/user/login"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String
|
||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String
|
||||
): ResponseEntity<kotlin.String> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Logs out current logged in user session",
|
||||
nickname = "logoutUser",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Logs out current logged in user session",
|
||||
nickname = "logoutUser",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
value = ["/user/logout"],
|
||||
method = [RequestMethod.GET])
|
||||
value = ["/user/logout"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun logoutUser(): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.logoutUser(), HttpStatus.OK)
|
||||
return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Updated user",
|
||||
nickname = "updateUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
value = "Updated user",
|
||||
nickname = "updateUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String
|
||||
value = ["/user/{username}"],
|
||||
consumes = ["application/json"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String
|
||||
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updateUser(username, user), HttpStatus.OK)
|
||||
return ResponseEntity(service.updateUser(username, user), HttpStatus.valueOf(400))
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ interface UserApiService {
|
||||
|
||||
suspend fun createUsersWithListInput(user: Flow<User>): Unit
|
||||
|
||||
suspend fun deleteUser(username: String): Unit
|
||||
suspend fun deleteUser(username: kotlin.String): Unit
|
||||
|
||||
suspend fun getUserByName(username: String): User
|
||||
suspend fun getUserByName(username: kotlin.String): User
|
||||
|
||||
suspend fun loginUser(username: String, password: String): String
|
||||
suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String
|
||||
|
||||
suspend fun logoutUser(): Unit
|
||||
|
||||
suspend fun updateUser(username: String, user: User): Unit
|
||||
suspend fun updateUser(username: kotlin.String, user: User): Unit
|
||||
}
|
||||
|
@ -18,15 +18,15 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deleteUser(username: String): Unit {
|
||||
override suspend fun deleteUser(username: kotlin.String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getUserByName(username: String): User {
|
||||
override suspend fun getUserByName(username: kotlin.String): User {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun loginUser(username: String, password: String): String {
|
||||
override suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updateUser(username: String, user: User): Unit {
|
||||
override suspend fun updateUser(username: kotlin.String, user: User): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Category (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class InlineObject (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated name of the pet")
|
||||
@JsonProperty("name") val name: String? = null,
|
||||
@JsonProperty("name") val name: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated status of the pet")
|
||||
@JsonProperty("status") val status: String? = null
|
||||
@JsonProperty("status") val status: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class InlineObject1 (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Additional data to pass to server")
|
||||
@JsonProperty("additionalMetadata") val additionalMetadata: String? = null,
|
||||
@JsonProperty("additionalMetadata") val additionalMetadata: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "file to upload")
|
||||
@JsonProperty("file") val file: org.springframework.core.io.Resource? = null
|
||||
|
@ -20,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class ModelApiResponse (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") val code: Int? = null,
|
||||
@JsonProperty("code") val code: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") val type: String? = null,
|
||||
@JsonProperty("type") val type: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") val message: String? = null
|
||||
@JsonProperty("message") val message: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Order (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") val petId: Long? = null,
|
||||
@JsonProperty("petId") val petId: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") val quantity: Int? = null,
|
||||
@JsonProperty("quantity") val quantity: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||
@ -39,14 +39,14 @@ data class Order (
|
||||
@JsonProperty("status") val status: Order.Status? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") val complete: Boolean? = null
|
||||
@JsonProperty("complete") val complete: kotlin.Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
enum class Status(val value: kotlin.String) {
|
||||
|
||||
@JsonProperty("placed") placed("placed"),
|
||||
|
||||
|
@ -27,20 +27,20 @@ data class Pet (
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") val name: String,
|
||||
@JsonProperty("name") val name: kotlin.String,
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") val photoUrls: List<String>,
|
||||
@JsonProperty("photoUrls") val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") val category: Category? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") val tags: List<Tag>? = null,
|
||||
@JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
@JsonProperty("status") val status: Pet.Status? = null
|
||||
@ -50,7 +50,7 @@ data class Pet (
|
||||
* pet status in the store
|
||||
* Values: available,pending,sold
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
enum class Status(val value: kotlin.String) {
|
||||
|
||||
@JsonProperty("available") available("available"),
|
||||
|
||||
|
@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Tag (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -25,28 +25,28 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class User (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") val username: String? = null,
|
||||
@JsonProperty("username") val username: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") val firstName: String? = null,
|
||||
@JsonProperty("firstName") val firstName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") val lastName: String? = null,
|
||||
@JsonProperty("lastName") val lastName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") val email: String? = null,
|
||||
@JsonProperty("email") val email: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") val password: String? = null,
|
||||
@JsonProperty("password") val password: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") val phone: String? = null,
|
||||
@JsonProperty("phone") val phone: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") val userStatus: Int? = null
|
||||
@JsonProperty("userStatus") val userStatus: kotlin.Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
4.0.1-SNAPSHOT
|
||||
4.1.3-SNAPSHOT
|
@ -86,6 +86,12 @@
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
|
@ -44,142 +44,141 @@ import kotlin.collections.Map
|
||||
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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.OK)
|
||||
return ResponseEntity(service.addPet(pet), 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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid pet value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
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<Unit> {
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
||||
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 = "read:pets", description = "read your pets")])])
|
||||
value = "Finds Pets by status",
|
||||
nickname = "findPetsByStatus",
|
||||
notes = "Multiple status values can be provided with comma separated strings",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>
|
||||
): ResponseEntity<List<Pet>> {
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
||||
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 = "read:pets", description = "read your pets")])])
|
||||
value = "Finds Pets by tags",
|
||||
nickname = "findPetsByTags",
|
||||
notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
|
||||
response = Pet::class,
|
||||
responseContainer = "List",
|
||||
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>
|
||||
,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: kotlin.Int?
|
||||
): ResponseEntity<List<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK)
|
||||
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")])
|
||||
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")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
||||
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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
value = ["/pet"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.OK)
|
||||
return ResponseEntity(service.updatePet(pet), 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")])])
|
||||
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")])
|
||||
value = [ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String?
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
||||
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")])])
|
||||
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)])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)])
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}/uploadImage"],
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
value = ["/pet/{petId}/uploadImage"],
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String?
|
||||
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
||||
): ResponseEntity<ModelApiResponse> {
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ interface PetApiService {
|
||||
|
||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet>
|
||||
|
||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>, maxCount: kotlin.Int?): List<Pet>
|
||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>
|
||||
|
||||
fun getPetById(petId: kotlin.Long): Pet
|
||||
|
||||
|
@ -18,7 +18,7 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>, maxCount: kotlin.Int?): List<Pet> {
|
||||
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user