mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-06 23:50:49 +00:00
Kotlin Misk Add Extra Parameters (#21271)
* first pass * squash * fixing FILES
This commit is contained in:
parent
cfe0b6fae3
commit
9b39c05563
@ -3,9 +3,16 @@ outputDir: samples/server/petstore/kotlin-misk-config
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-misk
|
||||
validateSpec: false
|
||||
useBeanValidation: true
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
moduleClassName: "PetStoreModule"
|
||||
generateStubImplClasses: true
|
||||
addModelMoshiJsonAnnotation: true
|
||||
actionPathPrefix : "samplePrefix"
|
||||
actionPathPrefix: "samplePrefix"
|
||||
actionAnnotations: "@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0);@Suppress(\"unused\")"
|
||||
actionImports: "misk.web.actions.WebAction;misk.web.interceptors.LogRequestResponse"
|
||||
actionParentClass: "WebAction"
|
||||
actionRequestContentType: "@RequestContentType"
|
||||
actionRequestContentTypePrefix: "MediaTypes"
|
||||
testingModule: "misk.web.MiskWebModule"
|
||||
|
@ -18,7 +18,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|actionAnnotations|String Annotations for Actions separated by a semicolon(;)| |@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)|
|
||||
|actionImports|String Imports for Actions separated by a semicolon(;)| |misk.web.actions.WebAction;misk.web.interceptors.LogRequestResponse|
|
||||
|actionParentClass|Parent Class for Action| |WebAction|
|
||||
|actionPathPrefix|Prefix for action path| ||
|
||||
|actionRequestContentType|Request ContentType for Action| |@RequestContentType|
|
||||
|actionRequestContentTypePrefix|Request ContentType Prefix for Action| |MediaTypes|
|
||||
|addModelMoshiJsonAnnotation|Add a Moshi JSON adapter annotation to all model classes| |true|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|
||||
|apiSuffix|suffix for api classes| |Api|
|
||||
@ -35,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|testingModule|Testing module class| |misk.testing.MiskTestModule|
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
@ -37,6 +37,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -55,6 +56,13 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
private static final String ROOT_PACKAGE = "rootPackage";
|
||||
public static final String GENERATE_STUB_IMPL_CLASSES = "generateStubImplClasses";
|
||||
public static final String ADD_MODEL_MOSHI_JSON_ANNOTATION = "addModelMoshiJsonAnnotation";
|
||||
public static final String ACTION_ANNOTATIONS = "actionAnnotations";
|
||||
public static final String ACTION_IMPORTS = "actionImports";
|
||||
public static final String ACTION_PARENT_CLASS = "actionParentClass";
|
||||
public static final String ACTION_REQUEST_CONTENT_TYPE = "actionRequestContentType";
|
||||
public static final String ACTION_REQUEST_CONTENT_TYPE_PREFIX = "actionRequestContentTypePrefix";
|
||||
public static final String TESTING_MODULE = "testingModule";
|
||||
private static final String TESTING_MODULE_NAME = "testingModuleName";
|
||||
|
||||
private boolean useBeanValidation = true;
|
||||
|
||||
@ -69,6 +77,15 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
|
||||
@Setter protected String moduleClassName = "OpenApiModule";
|
||||
@Setter protected String actionPathPrefix = "";
|
||||
@Setter protected List<String> actionAnnotations =
|
||||
List.of("@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)");
|
||||
@Setter protected List<String> actionImports =
|
||||
List.of("misk.web.actions.WebAction","misk.web.interceptors.LogRequestResponse");
|
||||
@Setter protected String actionParentClass = "WebAction";
|
||||
@Setter protected String actionRequestContentType = "@RequestContentType";
|
||||
@Setter protected String actionRequestContentTypePrefix = "MediaTypes";
|
||||
@Setter protected String testingModule = "misk.testing.MiskTestModule";
|
||||
@Setter protected String testingModuleName;
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
@ -122,6 +139,12 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
|
||||
addOption(MODULE_CLASS_NAME, "Name of the generated module class", moduleClassName);
|
||||
addOption(ACTION_PATH_PREFIX, "Prefix for action path", actionPathPrefix);
|
||||
addOption(ACTION_IMPORTS, "String Imports for Actions separated by a semicolon(;)", String.join(";", actionImports));
|
||||
addOption(ACTION_ANNOTATIONS, "String Annotations for Actions separated by a semicolon(;)", String.join(";", actionAnnotations));
|
||||
addOption(ACTION_PARENT_CLASS, "Parent Class for Action", actionParentClass);
|
||||
addOption(ACTION_REQUEST_CONTENT_TYPE, "Request ContentType for Action", actionRequestContentType);
|
||||
addOption(ACTION_REQUEST_CONTENT_TYPE_PREFIX, "Request ContentType Prefix for Action", actionRequestContentTypePrefix);
|
||||
addOption(TESTING_MODULE, "Testing module class", testingModule);
|
||||
|
||||
apiTestTemplateFiles.clear();
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".kt");
|
||||
@ -163,6 +186,23 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(ACTION_ANNOTATIONS)) {
|
||||
convertPropertyToTypeAndWriteBack(ACTION_ANNOTATIONS,
|
||||
it -> Arrays.asList(it.split(";")), this::setActionAnnotations);
|
||||
}
|
||||
writePropertyBack(ACTION_ANNOTATIONS, actionAnnotations);
|
||||
|
||||
if (additionalProperties.containsKey(ACTION_IMPORTS)) {
|
||||
convertPropertyToTypeAndWriteBack(ACTION_IMPORTS,
|
||||
it -> Arrays.asList(it.split(";")), this::setActionImports);
|
||||
}
|
||||
writePropertyBack(ACTION_IMPORTS, actionImports);
|
||||
|
||||
if (additionalProperties.containsKey(ACTION_PARENT_CLASS)) {
|
||||
setActionParentClass((String) additionalProperties.get(ACTION_PARENT_CLASS));
|
||||
}
|
||||
writePropertyBack(ACTION_PARENT_CLASS, actionParentClass);
|
||||
|
||||
if (additionalProperties.containsKey(MODULE_CLASS_NAME)) {
|
||||
setModuleClassName((String) additionalProperties.get(MODULE_CLASS_NAME));
|
||||
}
|
||||
@ -173,6 +213,23 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
}
|
||||
writePropertyBack(ACTION_PATH_PREFIX, actionPathPrefix);
|
||||
|
||||
if (additionalProperties.containsKey(ACTION_REQUEST_CONTENT_TYPE)) {
|
||||
setActionRequestContentType((String) additionalProperties.get(ACTION_REQUEST_CONTENT_TYPE));
|
||||
}
|
||||
writePropertyBack(ACTION_REQUEST_CONTENT_TYPE, actionRequestContentType);
|
||||
|
||||
if (additionalProperties.containsKey(ACTION_REQUEST_CONTENT_TYPE_PREFIX)) {
|
||||
setActionRequestContentTypePrefix((String) additionalProperties.get(ACTION_REQUEST_CONTENT_TYPE_PREFIX));
|
||||
}
|
||||
writePropertyBack(ACTION_REQUEST_CONTENT_TYPE_PREFIX, actionRequestContentTypePrefix);
|
||||
|
||||
if (additionalProperties.containsKey(TESTING_MODULE)) {
|
||||
setTestingModule((String) additionalProperties.get(TESTING_MODULE));
|
||||
}
|
||||
writePropertyBack(TESTING_MODULE, testingModule);
|
||||
|
||||
writePropertyBack(TESTING_MODULE_NAME, getTestingModuleName());
|
||||
|
||||
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
||||
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
|
||||
}
|
||||
@ -187,6 +244,7 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
setAddModelMoshiJsonAnnotation(convertPropertyToBoolean(ADD_MODEL_MOSHI_JSON_ANNOTATION));
|
||||
}
|
||||
writePropertyBack(ADD_MODEL_MOSHI_JSON_ANNOTATION, addModelMoshiJsonAnnotation);
|
||||
|
||||
applyJakartaPackage();
|
||||
|
||||
String apiModuleFolder = (sourceFolder + File.separator + apiPackage).replace(".", File.separator);
|
||||
@ -230,7 +288,11 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
}
|
||||
|
||||
private String mapMediaType(String mediaType) {
|
||||
return MEDIA_MAPPING.getOrDefault(mediaType, "MediaTypes.APPLICATION_OCTETSTREAM /* @todo(unknown) -> " + mediaType + " */ ");
|
||||
return MEDIA_MAPPING.getOrDefault(mediaType, "APPLICATION_OCTETSTREAM /* @todo(unknown) -> " + mediaType + " */ ");
|
||||
}
|
||||
|
||||
public String getTestingModuleName() {
|
||||
return testingModule.substring(testingModule.lastIndexOf(".")+1);
|
||||
}
|
||||
|
||||
private final static Map<String, String> MEDIA_MAPPING = getMappings();
|
||||
@ -238,31 +300,31 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
|
||||
private static Map<String, String> getMappings() {
|
||||
// add new values in order
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("*/*", "MediaTypes.ALL");
|
||||
result.put("*/*", "ALL");
|
||||
|
||||
result.put("application/grpc", "MediaTypes.APPLICATION_GRPC");
|
||||
result.put("application/javascript", "MediaTypes.APPLICATION_JAVASCRIPT");
|
||||
result.put("application/json", "MediaTypes.APPLICATION_JSON");
|
||||
result.put("application/jwt", "MediaTypes.APPLICATION_JWT");
|
||||
result.put("application/octetstream", "MediaTypes.APPLICATION_OCTETSTREAM");
|
||||
result.put("application/pdf", "MediaTypes.APPLICATION_OCTETSTREAM");
|
||||
result.put("application/x-protobuf", "MediaTypes.APPLICATION_PROTOBUF");
|
||||
result.put("application/x-www-form-urlencoded", "MediaTypes.APPLICATION_FORM_URLENCODED");
|
||||
result.put("application/xml", "MediaTypes.APPLICATION_XML");
|
||||
result.put("application/zip", "MediaTypes.APPLICATION_ZIP");
|
||||
result.put("application/grpc", "APPLICATION_GRPC");
|
||||
result.put("application/javascript", "APPLICATION_JAVASCRIPT");
|
||||
result.put("application/json", "APPLICATION_JSON");
|
||||
result.put("application/jwt", "APPLICATION_JWT");
|
||||
result.put("application/octetstream", "APPLICATION_OCTETSTREAM");
|
||||
result.put("application/pdf", "APPLICATION_OCTETSTREAM");
|
||||
result.put("application/x-protobuf", "APPLICATION_PROTOBUF");
|
||||
result.put("application/x-www-form-urlencoded", "APPLICATION_FORM_URLENCODED");
|
||||
result.put("application/xml", "APPLICATION_XML");
|
||||
result.put("application/zip", "APPLICATION_ZIP");
|
||||
|
||||
result.put("image/gif", "MediaTypes.IMAGE_GIF");
|
||||
result.put("image/x-icon", "MediaTypes.IMAGE_ICO");
|
||||
result.put("image/jpeg", "MediaTypes.IMAGE_JPEG");
|
||||
result.put("image/png", "MediaTypes.IMAGE_PNG");
|
||||
result.put("image/svg+xml", "MediaTypes.IMAGE_SVG");
|
||||
result.put("image/tiff", "MediaTypes.IMAGE_TIFF");
|
||||
result.put("image/gif", "IMAGE_GIF");
|
||||
result.put("image/x-icon", "IMAGE_ICO");
|
||||
result.put("image/jpeg", "IMAGE_JPEG");
|
||||
result.put("image/png", "IMAGE_PNG");
|
||||
result.put("image/svg+xml", "IMAGE_SVG");
|
||||
result.put("image/tiff", "IMAGE_TIFF");
|
||||
|
||||
result.put("multipart/form-data", "MediaTypes.FORM_DATA");
|
||||
result.put("multipart/form-data", "FORM_DATA");
|
||||
|
||||
result.put("text/css", "MediaTypes.TEXT_CSS");
|
||||
result.put("text/html", "MediaTypes.TEXT_HTML");
|
||||
result.put("text/plain", "MediaTypes.TEXT_PLAIN_UTF8");
|
||||
result.put("text/css", "TEXT_CSS");
|
||||
result.put("text/html", "TEXT_HTML");
|
||||
result.put("text/plain", "TEXT_PLAIN_UTF8");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -13,6 +13,9 @@ import {{javaxPackage}}.validation.constraints.NotNull
|
||||
import {{javaxPackage}}.validation.constraints.Pattern
|
||||
import {{javaxPackage}}.validation.constraints.Size
|
||||
{{/useBeanValidation}}
|
||||
{{#actionImports}}
|
||||
import {{{.}}}
|
||||
{{/actionImports}}
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -26,10 +29,9 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
{{#imports}}import {{import}}
|
||||
{{#imports}}
|
||||
import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
/**
|
||||
@ -38,14 +40,16 @@ import misk.web.mediatype.MediaTypes
|
||||
{{#operations}}
|
||||
@Singleton
|
||||
class {{classname}}Action @Inject constructor(
|
||||
) : WebAction {
|
||||
) : {{actionParentClass}} {
|
||||
{{#operation}}
|
||||
|
||||
@{{httpMethod}}("{{actionPathPrefix}}{{path}}")
|
||||
@{{httpMethod}}("{{{actionPathPrefix}}}{{path}}")
|
||||
@Description("{{{summary}}}"){{#hasConsumes}}
|
||||
@RequestContentType({{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}){{/hasConsumes}}{{#hasProduces}}
|
||||
@ResponseContentType({{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}){{/hasProduces}}
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
{{{actionRequestContentType}}}({{#consumes}}{{{actionRequestContentTypePrefix}}}.{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}){{/hasConsumes}}{{#hasProduces}}
|
||||
@ResponseContentType({{#produces}}MediaTypes.{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}){{/hasProduces}}
|
||||
{{#actionAnnotations}}
|
||||
{{{.}}}
|
||||
{{/actionAnnotations}}
|
||||
fun {{operationId}}({{#allParams}}
|
||||
{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{returnType}}}{{/returnType}} {
|
||||
TODO()
|
||||
|
@ -18,7 +18,8 @@ import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
{{#imports}}import {{import}}
|
||||
{{#imports}}
|
||||
import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,8 @@ import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
{{#imports}}import {{import}}
|
||||
{{#imports}}
|
||||
import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
{{#operations}}
|
||||
|
@ -1,36 +1,40 @@
|
||||
package {{package}}
|
||||
|
||||
import {{{testingModule}}}
|
||||
import {{javaxPackage}}.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{#imports}}
|
||||
import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class {{classname}}Test {
|
||||
|
||||
@Inject private lateinit var {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}: {{classname}}Action
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = {{{testingModuleName}}}()
|
||||
|
||||
@Inject private lateinit var {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}: {{classname}}Action
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
/**
|
||||
* To test {{classname}}Action.{{operationId}}
|
||||
*/
|
||||
@Test
|
||||
fun `should handle {{operationId}}`() {
|
||||
{{#allParams}}
|
||||
{{#allParams}}
|
||||
val {{{paramName}}} = TODO()
|
||||
{{/allParams}}
|
||||
{{/allParams}}
|
||||
val response{{#returnType}}: {{{returnType}}}{{/returnType}} = {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
||||
|
@ -39,6 +39,11 @@ public class KotlinMiskServerCodegenOptionsTest extends AbstractOptionsTest {
|
||||
verify(codegen).setUseBeanValidation(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.USE_BEAN_VALIDATION));
|
||||
verify(codegen).setModuleClassName(KotlinMiskServerCodegenOptionsProvider.MODULE_CLASS_NAME);
|
||||
verify(codegen).setActionPathPrefix(KotlinMiskServerCodegenOptionsProvider.ACTION_PATH_PREFIX);
|
||||
verify(codegen).setActionImports(List.of("a.x","b.y"));
|
||||
verify(codegen).setActionAnnotations(List.of("@c()","@d()"));
|
||||
verify(codegen).setActionParentClass(KotlinMiskServerCodegenOptionsProvider.ACTION_PARENT_CLASS);
|
||||
verify(codegen).setActionRequestContentType(KotlinMiskServerCodegenOptionsProvider.ACTION_REQUEST_CONTENT_TYPE);
|
||||
verify(codegen).setActionRequestContentTypePrefix(KotlinMiskServerCodegenOptionsProvider.ACTION_REQUEST_CONTENT_TYPE_PREFIX);
|
||||
verify(codegen).setGenerateStubImplClasses(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.GENERATE_STUB_IMPL_CLASSES));
|
||||
verify(codegen).setAddModelMoshiJsonAnnotation(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.ADD_MODEL_MOSHI_JSON_ANNOTATION));
|
||||
}
|
||||
|
@ -26,7 +26,13 @@ public class KotlinMiskServerCodegenOptionsProvider implements OptionsProvider {
|
||||
public static final String GENERATE_STUB_IMPL_CLASSES = "false";
|
||||
public static final String ADD_MODEL_MOSHI_JSON_ANNOTATION = "true";
|
||||
public static final String MODULE_CLASS_NAME = "OpenApiModule";
|
||||
public static final String ACTION_PATH_PREFIX = "samplePrefix";
|
||||
public static final String ACTION_PATH_PREFIX = "samplePrefix<";
|
||||
public static final String ACTION_IMPORTS = "a.x;b.y";
|
||||
public static final String ACTION_ANNOTATIONS = "@c();@d()";
|
||||
public static final String ACTION_PARENT_CLASS = "class<";
|
||||
public static final String ACTION_REQUEST_CONTENT_TYPE = "contentType<";
|
||||
public static final String ACTION_REQUEST_CONTENT_TYPE_PREFIX = "contentTypePrefix<";
|
||||
public static final String TESTING_MODULE = "testingModule";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
@ -55,8 +61,14 @@ public class KotlinMiskServerCodegenOptionsProvider implements OptionsProvider {
|
||||
.put(KotlinMiskServerCodegen.MODULE_CLASS_NAME, MODULE_CLASS_NAME)
|
||||
.put(BeanValidationFeatures.USE_BEANVALIDATION, USE_BEAN_VALIDATION)
|
||||
.put(KotlinMiskServerCodegen.ACTION_PATH_PREFIX, ACTION_PATH_PREFIX)
|
||||
.put(KotlinMiskServerCodegen.ACTION_IMPORTS, ACTION_IMPORTS)
|
||||
.put(KotlinMiskServerCodegen.ACTION_ANNOTATIONS, ACTION_ANNOTATIONS)
|
||||
.put(KotlinMiskServerCodegen.ACTION_PARENT_CLASS, ACTION_PARENT_CLASS)
|
||||
.put(KotlinMiskServerCodegen.ACTION_REQUEST_CONTENT_TYPE, ACTION_REQUEST_CONTENT_TYPE)
|
||||
.put(KotlinMiskServerCodegen.ACTION_REQUEST_CONTENT_TYPE_PREFIX, ACTION_REQUEST_CONTENT_TYPE_PREFIX)
|
||||
.put(KotlinMiskServerCodegen.ADD_MODEL_MOSHI_JSON_ANNOTATION, ADD_MODEL_MOSHI_JSON_ANNOTATION)
|
||||
.put(KotlinMiskServerCodegen.GENERATE_STUB_IMPL_CLASSES, GENERATE_STUB_IMPL_CLASSES)
|
||||
.put(KotlinMiskServerCodegen.TESTING_MODULE, TESTING_MODULE)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON, APPLICATION_XML
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
@ -154,7 +154,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="findPetsByTags"></a>
|
||||
# **findPetsByTags**
|
||||
@ -201,7 +201,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="getPetById"></a>
|
||||
# **getPetById**
|
||||
@ -248,7 +248,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
@ -294,8 +294,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON, APPLICATION_XML
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
@ -344,7 +344,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_FORM_URLENCODED
|
||||
- **Content-Type**: APPLICATION_FORM_URLENCODED
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
@ -395,6 +395,6 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.FORM_DATA
|
||||
- **Accept**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: FORM_DATA
|
||||
- **Accept**: APPLICATION_JSON
|
||||
|
||||
|
@ -97,7 +97,7 @@ This endpoint does not need any parameter.
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_JSON
|
||||
|
||||
<a name="getOrderById"></a>
|
||||
# **getOrderById**
|
||||
@ -144,7 +144,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="placeOrder"></a>
|
||||
# **placeOrder**
|
||||
@ -190,6 +190,6 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
|
@ -57,7 +57,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithArrayInput"></a>
|
||||
@ -103,7 +103,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithListInput"></a>
|
||||
@ -149,7 +149,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deleteUser"></a>
|
||||
@ -243,7 +243,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="loginUser"></a>
|
||||
# **loginUser**
|
||||
@ -292,7 +292,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="logoutUser"></a>
|
||||
# **logoutUser**
|
||||
@ -381,6 +381,6 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.ModelApiResponse
|
||||
import org.openapitools.server.api.model.Pet
|
||||
@ -41,7 +41,8 @@ class PetApiAction @Inject constructor(
|
||||
@Description("Add a new pet to the store")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun addPet(
|
||||
@Valid @RequestBody pet: Pet): Pet {
|
||||
TODO()
|
||||
@ -49,7 +50,8 @@ class PetApiAction @Inject constructor(
|
||||
|
||||
@Delete("samplePrefix/pet/{petId}")
|
||||
@Description("Deletes a pet")
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun deletePet(
|
||||
@PathParam("petId") petId: kotlin.Long,
|
||||
@RequestHeader(value = "api_key") apiKey: kotlin.String?) {
|
||||
@ -59,7 +61,8 @@ class PetApiAction @Inject constructor(
|
||||
@Get("samplePrefix/pet/findByStatus")
|
||||
@Description("Finds Pets by status")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun findPetsByStatus(
|
||||
@QueryParam(value = "status") status: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
|
||||
TODO()
|
||||
@ -68,7 +71,8 @@ class PetApiAction @Inject constructor(
|
||||
@Get("samplePrefix/pet/findByTags")
|
||||
@Description("Finds Pets by tags")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun findPetsByTags(
|
||||
@QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
|
||||
TODO()
|
||||
@ -77,7 +81,8 @@ class PetApiAction @Inject constructor(
|
||||
@Get("samplePrefix/pet/{petId}")
|
||||
@Description("Find pet by ID")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun getPetById(
|
||||
@PathParam("petId") petId: kotlin.Long): Pet {
|
||||
TODO()
|
||||
@ -87,7 +92,8 @@ class PetApiAction @Inject constructor(
|
||||
@Description("Update an existing pet")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun updatePet(
|
||||
@Valid @RequestBody pet: Pet): Pet {
|
||||
TODO()
|
||||
@ -96,7 +102,8 @@ class PetApiAction @Inject constructor(
|
||||
@Post("samplePrefix/pet/{petId}")
|
||||
@Description("Updates a pet in the store with form data")
|
||||
@RequestContentType(MediaTypes.APPLICATION_FORM_URLENCODED)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun updatePetWithForm(
|
||||
@PathParam("petId") petId: kotlin.Long,
|
||||
@QueryParam(value = "name") name: kotlin.String? ,
|
||||
@ -108,7 +115,8 @@ class PetApiAction @Inject constructor(
|
||||
@Description("uploads an image")
|
||||
@RequestContentType(MediaTypes.FORM_DATA)
|
||||
@ResponseContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun uploadFile(
|
||||
@PathParam("petId") petId: kotlin.Long,
|
||||
@QueryParam(value = "additionalMetadata") additionalMetadata: kotlin.String? ,
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.Order
|
||||
|
||||
@ -38,7 +38,8 @@ class StoreApiAction @Inject constructor(
|
||||
|
||||
@Delete("samplePrefix/store/order/{orderId}")
|
||||
@Description("Delete purchase order by ID")
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun deleteOrder(
|
||||
@PathParam("orderId") orderId: kotlin.String) {
|
||||
TODO()
|
||||
@ -47,7 +48,8 @@ class StoreApiAction @Inject constructor(
|
||||
@Get("samplePrefix/store/inventory")
|
||||
@Description("Returns pet inventories by status")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun getInventory(): kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||
TODO()
|
||||
}
|
||||
@ -55,7 +57,8 @@ class StoreApiAction @Inject constructor(
|
||||
@Get("samplePrefix/store/order/{orderId}")
|
||||
@Description("Find purchase order by ID")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun getOrderById(
|
||||
@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long): Order {
|
||||
TODO()
|
||||
@ -65,7 +68,8 @@ class StoreApiAction @Inject constructor(
|
||||
@Description("Place an order for a pet")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON)
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun placeOrder(
|
||||
@Valid @RequestBody order: Order): Order {
|
||||
TODO()
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.User
|
||||
|
||||
@ -39,7 +39,8 @@ class UserApiAction @Inject constructor(
|
||||
@Post("samplePrefix/user")
|
||||
@Description("Create user")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun createUser(
|
||||
@Valid @RequestBody user: User) {
|
||||
TODO()
|
||||
@ -48,7 +49,8 @@ class UserApiAction @Inject constructor(
|
||||
@Post("samplePrefix/user/createWithArray")
|
||||
@Description("Creates list of users with given input array")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun createUsersWithArrayInput(
|
||||
@Valid @RequestBody user: kotlin.Array<User>) {
|
||||
TODO()
|
||||
@ -57,7 +59,8 @@ class UserApiAction @Inject constructor(
|
||||
@Post("samplePrefix/user/createWithList")
|
||||
@Description("Creates list of users with given input array")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun createUsersWithListInput(
|
||||
@Valid @RequestBody user: kotlin.Array<User>) {
|
||||
TODO()
|
||||
@ -65,7 +68,8 @@ class UserApiAction @Inject constructor(
|
||||
|
||||
@Delete("samplePrefix/user/{username}")
|
||||
@Description("Delete user")
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun deleteUser(
|
||||
@PathParam("username") username: kotlin.String) {
|
||||
TODO()
|
||||
@ -74,7 +78,8 @@ class UserApiAction @Inject constructor(
|
||||
@Get("samplePrefix/user/{username}")
|
||||
@Description("Get user by user name")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun getUserByName(
|
||||
@PathParam("username") username: kotlin.String): User {
|
||||
TODO()
|
||||
@ -83,7 +88,8 @@ class UserApiAction @Inject constructor(
|
||||
@Get("samplePrefix/user/login")
|
||||
@Description("Logs user into the system")
|
||||
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun loginUser(
|
||||
@QueryParam(value = "username") username: kotlin.String,
|
||||
@QueryParam(value = "password") password: kotlin.String): kotlin.String {
|
||||
@ -92,7 +98,8 @@ class UserApiAction @Inject constructor(
|
||||
|
||||
@Get("samplePrefix/user/logout")
|
||||
@Description("Logs out current logged in user session")
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun logoutUser() {
|
||||
TODO()
|
||||
}
|
||||
@ -100,7 +107,8 @@ class UserApiAction @Inject constructor(
|
||||
@Put("samplePrefix/user/{username}")
|
||||
@Description("Updated user")
|
||||
@RequestContentType(MediaTypes.APPLICATION_JSON)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
|
||||
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
|
||||
@Suppress("unused")
|
||||
fun updateUser(
|
||||
@PathParam("username") username: kotlin.String,
|
||||
@Valid @RequestBody user: User) {
|
||||
|
@ -1,22 +1,26 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.web.MiskWebModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.ModelApiResponse
|
||||
import org.openapitools.server.api.model.Pet
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class PetApiTest {
|
||||
|
||||
@Inject private lateinit var petApi: PetApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskWebModule()
|
||||
|
||||
@Inject private lateinit var petApi: PetApiAction
|
||||
|
||||
/**
|
||||
* To test PetApiAction.addPet
|
||||
@ -94,5 +98,4 @@ internal class PetApiTest {
|
||||
val file = TODO()
|
||||
val response: ModelApiResponse = petApi.uploadFile(petId, additionalMetadata, file)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,25 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.web.MiskWebModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.Order
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class StoreApiTest {
|
||||
|
||||
@Inject private lateinit var storeApi: StoreApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskWebModule()
|
||||
|
||||
@Inject private lateinit var storeApi: StoreApiAction
|
||||
|
||||
/**
|
||||
* To test StoreApiAction.deleteOrder
|
||||
@ -51,5 +55,4 @@ internal class StoreApiTest {
|
||||
val order = TODO()
|
||||
val response: Order = storeApi.placeOrder(order)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,25 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.web.MiskWebModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.User
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class UserApiTest {
|
||||
|
||||
@Inject private lateinit var userApi: UserApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskWebModule()
|
||||
|
||||
@Inject private lateinit var userApi: UserApiAction
|
||||
|
||||
/**
|
||||
* To test UserApiAction.createUser
|
||||
@ -89,5 +93,4 @@ internal class UserApiTest {
|
||||
val user = TODO()
|
||||
val response = userApi.updateUser(username, user)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON, APPLICATION_XML
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
@ -154,7 +154,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="findPetsByTags"></a>
|
||||
# **findPetsByTags**
|
||||
@ -201,7 +201,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="getPetById"></a>
|
||||
# **getPetById**
|
||||
@ -248,7 +248,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
@ -294,8 +294,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON, APPLICATION_XML
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
@ -344,7 +344,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_FORM_URLENCODED
|
||||
- **Content-Type**: APPLICATION_FORM_URLENCODED
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
@ -395,6 +395,6 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.FORM_DATA
|
||||
- **Accept**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: FORM_DATA
|
||||
- **Accept**: APPLICATION_JSON
|
||||
|
||||
|
@ -97,7 +97,7 @@ This endpoint does not need any parameter.
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_JSON
|
||||
|
||||
<a name="getOrderById"></a>
|
||||
# **getOrderById**
|
||||
@ -144,7 +144,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="placeOrder"></a>
|
||||
# **placeOrder**
|
||||
@ -190,6 +190,6 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
|
@ -57,7 +57,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithArrayInput"></a>
|
||||
@ -103,7 +103,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithListInput"></a>
|
||||
@ -149,7 +149,7 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deleteUser"></a>
|
||||
@ -243,7 +243,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="loginUser"></a>
|
||||
# **loginUser**
|
||||
@ -292,7 +292,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON
|
||||
- **Accept**: APPLICATION_XML, APPLICATION_JSON
|
||||
|
||||
<a name="logoutUser"></a>
|
||||
# **logoutUser**
|
||||
@ -381,6 +381,6 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: MediaTypes.APPLICATION_JSON
|
||||
- **Content-Type**: APPLICATION_JSON
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.ModelApiResponse
|
||||
import org.openapitools.server.api.model.Pet
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.Order
|
||||
|
||||
|
@ -11,6 +11,8 @@ import jakarta.validation.constraints.Min
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.Delete
|
||||
import misk.web.Description
|
||||
import misk.web.Get
|
||||
@ -24,8 +26,6 @@ import misk.web.RequestBody
|
||||
import misk.web.RequestContentType
|
||||
import misk.web.RequestHeader
|
||||
import misk.web.ResponseContentType
|
||||
import misk.web.actions.WebAction
|
||||
import misk.web.interceptors.LogRequestResponse
|
||||
import misk.web.mediatype.MediaTypes
|
||||
import org.openapitools.server.api.model.User
|
||||
|
||||
|
@ -1,22 +1,26 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.testing.MiskTestModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.ModelApiResponse
|
||||
import org.openapitools.server.api.model.Pet
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class PetApiTest {
|
||||
|
||||
@Inject private lateinit var petApi: PetApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskTestModule()
|
||||
|
||||
@Inject private lateinit var petApi: PetApiAction
|
||||
|
||||
/**
|
||||
* To test PetApiAction.addPet
|
||||
@ -94,5 +98,4 @@ internal class PetApiTest {
|
||||
val file = TODO()
|
||||
val response: ModelApiResponse = petApi.uploadFile(petId, additionalMetadata, file)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,25 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.testing.MiskTestModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.Order
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class StoreApiTest {
|
||||
|
||||
@Inject private lateinit var storeApi: StoreApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskTestModule()
|
||||
|
||||
@Inject private lateinit var storeApi: StoreApiAction
|
||||
|
||||
/**
|
||||
* To test StoreApiAction.deleteOrder
|
||||
@ -51,5 +55,4 @@ internal class StoreApiTest {
|
||||
val order = TODO()
|
||||
val response: Order = storeApi.placeOrder(order)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,25 @@
|
||||
package org.openapitools.server.api.api
|
||||
|
||||
import misk.testing.MiskTestModule
|
||||
import jakarta.inject.Inject
|
||||
import misk.testing.MiskTest
|
||||
import misk.testing.MiskTestModule
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import misk.web.HttpCall
|
||||
import misk.web.PathParam
|
||||
import misk.web.QueryParam
|
||||
import misk.web.RequestBody
|
||||
import misk.web.RequestHeader
|
||||
|
||||
import org.openapitools.server.api.model.User
|
||||
|
||||
@MiskTest(startService = true)
|
||||
internal class UserApiTest {
|
||||
|
||||
@Inject private lateinit var userApi: UserApi
|
||||
@Suppress("unused")
|
||||
@MiskTestModule
|
||||
private val module = MiskTestModule()
|
||||
|
||||
@Inject private lateinit var userApi: UserApiAction
|
||||
|
||||
/**
|
||||
* To test UserApiAction.createUser
|
||||
@ -89,5 +93,4 @@ internal class UserApiTest {
|
||||
val user = TODO()
|
||||
val response = userApi.updateUser(username, user)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user