forked from loafle/openapi-generator-original
[scala] strip model class name for all scala generators (#5439)
* stripped parameter enabled for all scala based generators * scala samples updated * docs generators updated * fix scalatra. regenerated by openapi3 script. manually removed enum default value from scalatra example due bug in schema extraction
This commit is contained in:
parent
cc20eb8109
commit
84250973be
@ -67,56 +67,44 @@ sidebar_label: scalatra
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>abstract</li>
|
||||
<li>assert</li>
|
||||
<li>boolean</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>class</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>default</li>
|
||||
<li>def</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>extends</li>
|
||||
<li>false</li>
|
||||
<li>final</li>
|
||||
<li>finally</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>goto</li>
|
||||
<li>forSome</li>
|
||||
<li>if</li>
|
||||
<li>implements</li>
|
||||
<li>implicit</li>
|
||||
<li>import</li>
|
||||
<li>instanceof</li>
|
||||
<li>int</li>
|
||||
<li>interface</li>
|
||||
<li>long</li>
|
||||
<li>native</li>
|
||||
<li>lazy</li>
|
||||
<li>match</li>
|
||||
<li>new</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>override</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>return</li>
|
||||
<li>short</li>
|
||||
<li>static</li>
|
||||
<li>strictfp</li>
|
||||
<li>sealed</li>
|
||||
<li>super</li>
|
||||
<li>switch</li>
|
||||
<li>synchronized</li>
|
||||
<li>this</li>
|
||||
<li>throw</li>
|
||||
<li>throws</li>
|
||||
<li>transient</li>
|
||||
<li>trait</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>type</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>val</li>
|
||||
<li>var</li>
|
||||
<li>while</li>
|
||||
<li>with</li>
|
||||
<li>yield</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
@ -115,6 +115,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -319,6 +320,31 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
final String sanitizedName = sanitizeName(modelNamePrefix + this.stripPackageName(name) + modelNameSuffix);
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
final String camelizedName = camelize(sanitizedName);
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
return camelizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
// should be the same as the model name
|
||||
|
@ -49,6 +49,7 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
||||
protected boolean registerNonStandardStatusCodes = true;
|
||||
protected boolean renderJavadoc = true;
|
||||
protected boolean removeOAuthSecurities = true;
|
||||
// protected boolean stripPackageName = false;
|
||||
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
@ -304,11 +305,6 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
return formatIdentifier(name, true);
|
||||
}
|
||||
|
||||
private static abstract class CustomLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
||||
|
@ -105,7 +105,6 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code
|
||||
additionalProperties.put("authScheme", authScheme);
|
||||
additionalProperties.put("authPreemptive", authPreemptive);
|
||||
additionalProperties.put("clientName", clientName);
|
||||
additionalProperties.put(CodegenConstants.STRIP_PACKAGE_NAME, stripPackageName);
|
||||
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
||||
@ -267,31 +266,6 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
final String sanitizedName = sanitizeName(modelNamePrefix + this.stripPackageName(name) + modelNameSuffix);
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
final String camelizedName = camelize(sanitizedName);
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
return camelizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return formatIdentifier(stripPackageName(property.baseName), true);
|
||||
|
@ -229,35 +229,6 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix);
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
final String camelizedName = camelize(sanitizedName);
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(
|
||||
camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
final String modelName =
|
||||
"Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(
|
||||
name + " (model name starts with number) cannot be used as model name. Renamed to "
|
||||
+ modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
return camelizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||
objs = super.postProcessModelsEnum(objs);
|
||||
|
@ -57,17 +57,6 @@ public class ScalatraServerCodegen extends AbstractScalaCodegen implements Codeg
|
||||
apiPackage = "org.openapitools.server.api";
|
||||
modelPackage = "org.openapitools.server.model";
|
||||
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
"abstract", "continue", "for", "new", "switch", "assert",
|
||||
"default", "if", "package", "synchronized", "boolean", "do", "goto", "private",
|
||||
"this", "break", "double", "implements", "protected", "throw", "byte", "else",
|
||||
"import", "public", "throws", "case", "enum", "instanceof", "return", "transient",
|
||||
"catch", "extends", "int", "short", "try", "char", "final", "interface", "static",
|
||||
"void", "class", "finally", "long", "strictfp", "volatile", "const", "float",
|
||||
"native", "super", "while", "type")
|
||||
);
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
Arrays.asList("double",
|
||||
"Int",
|
||||
|
@ -274,31 +274,6 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
final String sanitizedName = sanitizeName(modelNamePrefix + this.stripPackageName(name) + modelNameSuffix);
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
final String camelizedName = camelize(sanitizedName);
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
return camelizedName;
|
||||
}
|
||||
|
||||
private static abstract class CustomLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
||||
|
@ -1 +1 @@
|
||||
{{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{/required}}{{^required}}{{#isContainer}}{{dataType}}{{/isContainer}}{{^isContainer}}Option[{{dataType}}]{{/isContainer}}{{/required}}{{^defaultValue}}{{^required}}{{^isContainer}} = None{{/isContainer}}{{/required}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#authMethods.0}})(implicit {{#authMethods}}{{#isApiKey}}apiKey: ApiKeyValue{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}basicAuth: BasicCredentials{{/isBasicBasic}}{{#isBasicBearer}}bearerToken: BearerToken{{/isBasicBearer}}{{/isBasic}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}{{/authMethods.0}}
|
||||
{{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{/required}}{{^required}}{{#isContainer}}{{dataType}}{{/isContainer}}{{^isContainer}}Option[{{dataType}}]{{/isContainer}}{{/required}}{{^defaultValue}}{{^required}}{{^isContainer}} = None{{/isContainer}}{{/required}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#authMethods.0}})(implicit {{#authMethods}}{{#isApiKey}}apiKey: ApiKeyValue{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}basicAuth: BasicCredentials{{/isBasicBasic}}{{#isBasicBearer}}bearerToken: BearerToken{{/isBasicBearer}}{{/isBasic}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}{{/authMethods.0}}
|
@ -363,4 +363,28 @@ public class ScalaAkkaClientCodegenTest {
|
||||
generatedFiles.get(someObjFilename),
|
||||
Resources.toString(Resources.getResource("codegen/scala/SomeObj.scala.txt"), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test(description = "strip model name")
|
||||
public void stripModelNameTest() throws Exception {
|
||||
final Schema model = new Schema()
|
||||
.description("a map model");
|
||||
final DefaultCodegen codegen = new ScalaAkkaClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
|
||||
final CodegenModel cms = codegen.fromModel("Stripped.ByDefault.ModelName", model);
|
||||
Assert.assertEquals(cms.name, "Stripped.ByDefault.ModelName");
|
||||
Assert.assertEquals(cms.classname, "ModelName");
|
||||
Assert.assertEquals(cms.classFilename, "ModelName");
|
||||
|
||||
codegen.additionalProperties().put(CodegenConstants.STRIP_PACKAGE_NAME, "false");
|
||||
codegen.processOpts();
|
||||
|
||||
final CodegenModel cm = codegen.fromModel("Non.Stripped.ModelName", model);
|
||||
|
||||
Assert.assertEquals(cm.name, "Non.Stripped.ModelName");
|
||||
Assert.assertEquals(cm.classname, "NonStrippedModelName");
|
||||
Assert.assertEquals(cm.classFilename, "NonStrippedModelName");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Example
|
||||
license:
|
||||
name: MIT
|
||||
servers:
|
||||
- url: http://api.example.xyz/v1
|
||||
paths:
|
||||
/deprecated-test:
|
||||
x-swagger-router-controller: /deprecated-test
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Non.Stripped.Request'
|
||||
responses:
|
||||
'200':
|
||||
description: responses
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Response'
|
||||
components:
|
||||
schemas:
|
||||
Non.Stripped.Request:
|
||||
type: object
|
||||
properties:
|
||||
customerCode:
|
||||
type: string
|
||||
example: '0001'
|
||||
firstName:
|
||||
type: string
|
||||
deprecated: true
|
||||
example: 'first'
|
||||
Response:
|
||||
type: object
|
||||
properties:
|
||||
customerCode:
|
||||
type: string
|
||||
example: '0001'
|
||||
firstName:
|
||||
type: string
|
||||
deprecated: true
|
||||
example: 'first'
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -118,3 +118,4 @@ Authentication schemes defined for the API:
|
||||
## Author
|
||||
|
||||
|
||||
|
||||
|
@ -128,6 +128,8 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomC
|
||||
req.withHeaders(Authorization(BasicHttpCredentials(login, password)))
|
||||
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
||||
req.withHeaders(RawHeader(keyName, keyValue.value))
|
||||
case (req, BearerToken(token)) =>
|
||||
req.withHeaders(RawHeader("Authorization", s"Bearer $token"))
|
||||
case (req, _) => req
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ sealed trait Credentials {
|
||||
|
||||
sealed case class BasicCredentials(user: String, password: String) extends Credentials
|
||||
|
||||
sealed case class BearerToken(token: String) extends Credentials
|
||||
|
||||
sealed case class ApiKeyCredentials(key: ApiKeyValue, keyName: String, location: ApiKeyLocation) extends Credentials {
|
||||
override def asQueryParam: Option[(String, String)] = location match {
|
||||
case ApiKeyLocations.QUERY => Some((keyName, key.value))
|
||||
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -109,7 +109,7 @@ ext {
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -11,7 +11,7 @@
|
||||
<pluginRepository>
|
||||
<id>maven-mongodb-plugin-repo</id>
|
||||
<name>maven mongodb plugin repository</name>
|
||||
<!-- TODO: this URL does not exist -->
|
||||
<!-- TODO: this URL does not exist. -->
|
||||
<url>https://maven-mongodb-plugin.googlecode.com/svn/maven/repo</url>
|
||||
<layout>default</layout>
|
||||
</pluginRepository>
|
||||
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -2,7 +2,7 @@
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
This Scala Play Framework project was generated by the OpenAPI generator tool at 2020-01-04T23:10:22.106-05:00[America/New_York].
|
||||
This Scala Play Framework project was generated by the OpenAPI generator tool at 2020-02-25T23:20:59.671788+07:00[Asia/Bangkok].
|
||||
|
||||
## API
|
||||
|
||||
|
@ -4,7 +4,7 @@ import model.ApiResponse
|
||||
import model.Pet
|
||||
import play.api.libs.Files.TemporaryFile
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
trait PetApi {
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
|
@ -8,7 +8,7 @@ import model.ApiResponse
|
||||
import model.Pet
|
||||
import play.api.libs.Files.TemporaryFile
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
@Singleton
|
||||
class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends AbstractController(cc) {
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ import play.api.libs.Files.TemporaryFile
|
||||
/**
|
||||
* Provides a default implementation for [[PetApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
class PetApiImpl extends PetApi {
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import model.Order
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
trait StoreApi {
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
import play.api.mvc._
|
||||
import model.Order
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
@Singleton
|
||||
class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) extends AbstractController(cc) {
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@ import model.Order
|
||||
/**
|
||||
* Provides a default implementation for [[StoreApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
class StoreApiImpl extends StoreApi {
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import model.User
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
trait UserApi {
|
||||
/**
|
||||
* Create user
|
||||
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
import play.api.mvc._
|
||||
import model.User
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
@Singleton
|
||||
class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extends AbstractController(cc) {
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@ import model.User
|
||||
/**
|
||||
* Provides a default implementation for [[UserApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
class UserApiImpl extends UserApi {
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class ApiResponse(
|
||||
code: Option[Int],
|
||||
`type`: Option[String],
|
||||
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* A category for a pet
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class Category(
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
|
@ -7,7 +7,7 @@ import java.time.OffsetDateTime
|
||||
* An order for a pets from the pet store
|
||||
* @param status Order Status
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class Order(
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
||||
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
* A pet for sale in the pet store
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class Pet(
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
||||
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* A tag for a pet
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class Tag(
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
* A User who is purchasing from the pet store
|
||||
* @param userStatus User Status
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
case class User(
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
||||
|
@ -4,7 +4,7 @@ import api._
|
||||
import play.api.inject.{Binding, Module => PlayModule}
|
||||
import play.api.{Configuration, Environment}
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-02-25T23:20:59.671788+07:00[Asia/Bangkok]")
|
||||
class Module extends PlayModule {
|
||||
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = Seq(
|
||||
bind[PetApi].to[PetApiImpl],
|
||||
|
@ -1 +1 @@
|
||||
3.0.0-SNAPSHOT
|
||||
4.3.0-SNAPSHOT
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
@ -41,7 +41,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
}
|
||||
|
||||
|
||||
val addPetOperation = (apiOperation[Unit]("addPet")
|
||||
val addPetOperation = (apiOperation[Pet]("addPet")
|
||||
summary "Add a new pet to the store"
|
||||
parameters(bodyParam[Pet]("pet").description(""))
|
||||
)
|
||||
@ -118,7 +118,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
|
||||
|
||||
|
||||
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
||||
val updatePetOperation = (apiOperation[Pet]("updatePet")
|
||||
summary "Update an existing pet"
|
||||
parameters(bodyParam[Pet]("pet").description(""))
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
package org.openapitools.server.model
|
||||
|
||||
case class InlineObject(
|
||||
/* Updated name of the pet */
|
||||
name: Option[String],
|
||||
|
||||
/* Updated status of the pet */
|
||||
status: Option[String]
|
||||
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
package org.openapitools.server.model
|
||||
import java.io.File
|
||||
|
||||
case class InlineObject1(
|
||||
/* Additional data to pass to server */
|
||||
additionalMetadata: Option[String],
|
||||
|
||||
/* file to upload */
|
||||
file: Option[File]
|
||||
|
||||
)
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
package org.openapitools.server.model
|
||||
import java.util.Date
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Order(
|
||||
id: Option[Long],
|
||||
@ -19,7 +19,7 @@ case class Order(
|
||||
|
||||
quantity: Option[Int],
|
||||
|
||||
shipDate: Option[Date],
|
||||
shipDate: Option[DateTime],
|
||||
|
||||
/* Order Status */
|
||||
status: Option[String],
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
@ -2,7 +2,7 @@
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
Loading…
x
Reference in New Issue
Block a user