Merge remote-tracking branch 'origin/master' into 5.1.x

This commit is contained in:
William Cheng
2021-01-08 21:06:47 +08:00
954 changed files with 41988 additions and 4607 deletions

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,16 @@
README.md
build.gradle
docs/ApiResponse.md
docs/Category.md
docs/Order.md
docs/Pet.md
docs/Tag.md
docs/User.md
ktorm_schema.sql
settings.gradle
src/main/kotlin/org/openapitools/database/models/ApiResponse.kt
src/main/kotlin/org/openapitools/database/models/Category.kt
src/main/kotlin/org/openapitools/database/models/Order.kt
src/main/kotlin/org/openapitools/database/models/Pet.kt
src/main/kotlin/org/openapitools/database/models/Tag.kt
src/main/kotlin/org/openapitools/database/models/User.kt

View File

@@ -0,0 +1 @@
5.1.0-SNAPSHOT

View File

@@ -0,0 +1,29 @@
# org.openapitools.database - Kotlin database library for OpenAPI Petstore
## Requires
## Build
```
./gradlew check assemble
```
This runs all tests and packages the library.
## Features/Implementation Notes
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
* Supports Mapper using API model classes.
* Supports SQLite types.
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.database.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.database.models.Category](docs/Category.md)
- [org.openapitools.database.models.Order](docs/Order.md)
- [org.openapitools.database.models.Pet](docs/Pet.md)
- [org.openapitools.database.models.Tag](docs/Tag.md)
- [org.openapitools.database.models.User](docs/User.md)

View File

@@ -0,0 +1,35 @@
group 'org.openapitools'
version '1.0.0'
wrapper {
gradleVersion = '4.9'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
ext.kotlin_version = '1.3.72'
ext.ktorm_version = '3.2.0'
repositories {
maven { url "https://repo1.maven.org/maven2" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
maven { url "https://repo1.maven.org/maven2" }
}
test {
useJUnitPlatform()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.ktorm:ktorm-core:$ktorm_version"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.1.0"
}

View File

@@ -0,0 +1,15 @@
# Table `ApiResponse`
(mapped from: ApiResponse)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**code** | code | int | | **kotlin.Int** | | [optional]
**type** | type | text | | **kotlin.String** | | [optional]
**message** | message | text | | **kotlin.String** | | [optional]

View File

@@ -0,0 +1,13 @@
# Table `Category`
(mapped from: Category)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional]
**name** | name | text | | **kotlin.String** | | [optional]

View File

@@ -0,0 +1,21 @@
# Table `Order`
(mapped from: Order)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional]
**petId** | petId | long | | **kotlin.Long** | | [optional]
**quantity** | quantity | int | | **kotlin.Int** | | [optional]
**shipDate** | shipDate | datetime | | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
**status** | status | text | | [**status**](#StatusEnum) | Order Status | [optional]
**complete** | complete | boolean | | **kotlin.Boolean** | | [optional]

View File

@@ -0,0 +1,41 @@
# Table `Pet`
(mapped from: Pet)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**name** | name | text NOT NULL | | **kotlin.String** | |
**photoUrls** | `One-To-Many` | `----` | `----` | **kotlin.Array&lt;kotlin.String&gt;** | |
**id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional]
**category** | category | long | | [**Category**](Category.md) | | [optional] [foreignkey]
**tags** | `One-To-Many` | `----` | `----` | [**kotlin.Array&lt;Tag&gt;**](Tag.md) | | [optional]
**status** | status | text | | [**status**](#StatusEnum) | pet status in the store | [optional]
# **Table `PetPhotoUrls`**
(mapped from: PetPhotoUrls)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
pet | pet | long | | kotlin.Long | Primary Key | *one*
photoUrls | photoUrls | text | | kotlin.String | Foreign Key | *many*
# **Table `PetTag`**
(mapped from: PetTag)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
pet | pet | long | | kotlin.Long | Primary Key | *one*
tag | tag | long | | kotlin.Long | Foreign Key | *many*

View File

@@ -0,0 +1,13 @@
# Table `Tag`
(mapped from: Tag)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional]
**name** | name | text | | **kotlin.String** | | [optional]

View File

@@ -0,0 +1,25 @@
# Table `User`
(mapped from: User)
## Properties
Name | Mapping | SQL Type | Default | Type | Description | Notes
---- | ------- | -------- | ------- | ---- | ----------- | -----
**id** | id | long PRIMARY KEY AUTOINCREMENT | | **kotlin.Long** | | [optional]
**username** | username | text | | **kotlin.String** | | [optional]
**firstName** | firstName | text | | **kotlin.String** | | [optional]
**lastName** | lastName | text | | **kotlin.String** | | [optional]
**email** | email | text | | **kotlin.String** | | [optional]
**password** | password | text | | **kotlin.String** | | [optional]
**phone** | phone | text | | **kotlin.String** | | [optional]
**userStatus** | userStatus | int | | **kotlin.Int** | User Status | [optional]

Binary file not shown.

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
samples/schema/petstore/ktorm/gradlew vendored Normal file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,211 @@
-- --------------------------------------------------------------------------
-- Table structure for table `ApiResponse` generated from model 'apiResponse'
-- Describes the result of uploading an image resource
--
CREATE TABLE IF NOT EXISTS `ApiResponse` (
`code` int,
`type` text,
`message` text
); /*Describes the result of uploading an image resource*/
-- --------------------------------------------------------------------------
-- Table structure for table `Category` generated from model 'category'
-- A category for a pet
--
CREATE TABLE IF NOT EXISTS `Category` (
`id` long PRIMARY KEY AUTOINCREMENT,
`name` text
); /*A category for a pet*/
-- --------------------------------------------------------------------------
-- Table structure for table `Order` generated from model 'order'
-- An order for a pets from the pet store
--
CREATE TABLE IF NOT EXISTS `Order` (
`id` long PRIMARY KEY AUTOINCREMENT,
`petId` long,
`quantity` int,
`shipDate` datetime,
`status` text /*Order Status*/,
`complete` boolean
); /*An order for a pets from the pet store*/
-- --------------------------------------------------------------------------
-- Table structure for table `Pet` generated from model 'pet'
-- A pet for sale in the pet store
--
CREATE TABLE IF NOT EXISTS `Pet` (
`name` text NOT NULL,
`id` long PRIMARY KEY AUTOINCREMENT,
`category` long,
`status` text /*pet status in the store*/
); /*A pet for sale in the pet store*/
-- --------------------------------------------------------------------------
-- Table structure for table `PetPhotoUrls` generated from model 'PetPhotoUrls'
CREATE TABLE IF NOT EXISTS `PetPhotoUrls` (
`pet` long NOT NULL
`photoUrls` text NOT NULL
);
-- --------------------------------------------------------------------------
-- Table structure for table `PetTag` generated from model 'PetTag'
CREATE TABLE IF NOT EXISTS `PetTag` (
`pet` long NOT NULL
`tag` long NOT NULL
);
-- --------------------------------------------------------------------------
-- Table structure for table `Tag` generated from model 'tag'
-- A tag for a pet
--
CREATE TABLE IF NOT EXISTS `Tag` (
`id` long PRIMARY KEY AUTOINCREMENT,
`name` text
); /*A tag for a pet*/
-- --------------------------------------------------------------------------
-- Table structure for table `User` generated from model 'user'
-- A User who is purchasing from the pet store
--
CREATE TABLE IF NOT EXISTS `User` (
`id` long PRIMARY KEY AUTOINCREMENT,
`username` text,
`firstName` text,
`lastName` text,
`email` text,
`password` text,
`phone` text,
`userStatus` int /*User Status*/
); /*A User who is purchasing from the pet store*/
--
-- OAuth2 framework tables
-- Thanks to https://github.com/dsquier/oauth2-server-php-mysql repo
--
--
-- Table structure for table `oauth_clients`
--
CREATE TABLE IF NOT EXISTS `oauth_clients` (
`client_id` VARCHAR(80) NOT NULL,
`client_secret` VARCHAR(80) DEFAULT NULL,
`redirect_uri` VARCHAR(2000) DEFAULT NULL,
`grant_types` VARCHAR(80) DEFAULT NULL,
`scope` VARCHAR(4000) DEFAULT NULL,
`user_id` VARCHAR(80) DEFAULT NULL,
PRIMARY KEY (`client_id`)
);
--
-- Table structure for table `oauth_access_tokens`
--
CREATE TABLE IF NOT EXISTS `oauth_access_tokens` (
`access_token` VARCHAR(40) NOT NULL,
`client_id` VARCHAR(80) DEFAULT NULL,
`user_id` VARCHAR(80) DEFAULT NULL,
`expires` TIMESTAMP NOT NULL,
`scope` VARCHAR(4000) DEFAULT NULL,
PRIMARY KEY (`access_token`)
);
--
-- Table structure for table `oauth_authorization_codes`
--
CREATE TABLE IF NOT EXISTS `oauth_authorization_codes` (
`authorization_code` VARCHAR(40) NOT NULL,
`client_id` VARCHAR(80) DEFAULT NULL,
`user_id` VARCHAR(80) DEFAULT NULL,
`redirect_uri` VARCHAR(2000) NOT NULL,
`expires` TIMESTAMP NOT NULL,
`scope` VARCHAR(4000) DEFAULT NULL,
`id_token` VARCHAR(1000) DEFAULT NULL,
PRIMARY KEY (`authorization_code`)
);
--
-- Table structure for table `oauth_refresh_tokens`
--
CREATE TABLE IF NOT EXISTS `oauth_refresh_tokens` (
`refresh_token` VARCHAR(40) NOT NULL,
`client_id` VARCHAR(80) DEFAULT NULL,
`user_id` VARCHAR(80) DEFAULT NULL,
`expires` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`scope` VARCHAR(4000) DEFAULT NULL,
PRIMARY KEY (`refresh_token`)
);
--
-- Table structure for table `oauth_users`
--
CREATE TABLE IF NOT EXISTS `oauth_users` (
`username` VARCHAR(80) DEFAULT NULL,
`password` VARCHAR(255) DEFAULT NULL,
`first_name` VARCHAR(80) DEFAULT NULL,
`last_name` VARCHAR(80) DEFAULT NULL,
`email` VARCHAR(2000) DEFAULT NULL,
`email_verified` TINYINT(1) DEFAULT NULL,
`scope` VARCHAR(4000) DEFAULT NULL
);
--
-- Table structure for table `oauth_scopes`
--
CREATE TABLE IF NOT EXISTS `oauth_scopes` (
`scope` VARCHAR(80) NOT NULL,
`is_default` TINYINT(1) DEFAULT NULL,
PRIMARY KEY (`scope`)
);
--
-- Table structure for table `oauth_jwt`
--
CREATE TABLE IF NOT EXISTS `oauth_jwt` (
`client_id` VARCHAR(80) NOT NULL,
`subject` VARCHAR(80) DEFAULT NULL,
`public_key` VARCHAR(2000) NOT NULL
);
--
-- Table structure for table `oauth_jti`
--
CREATE TABLE IF NOT EXISTS `oauth_jti` (
`issuer` VARCHAR(80) NOT NULL,
`subject` VARCHAR(80) DEFAULT NULL,
`audiance` VARCHAR(80) DEFAULT NULL,
`expires` TIMESTAMP NOT NULL,
`jti` VARCHAR(2000) NOT NULL
);
--
-- Table structure for table `oauth_public_keys`
--
CREATE TABLE IF NOT EXISTS `oauth_public_keys` (
`client_id` VARCHAR(80) DEFAULT NULL,
`public_key` VARCHAR(2000) DEFAULT NULL,
`private_key` VARCHAR(2000) DEFAULT NULL,
`encryption_algorithm` VARCHAR(100) DEFAULT 'RS256'
);
--
-- Table structure for table `_db_version`
--
CREATE TABLE IF NOT EXISTS `_db_version` (
`version` LONG DEFAULT 1
);

View File

@@ -0,0 +1 @@
rootProject.name = 'ktorm'

View File

@@ -0,0 +1,38 @@
/**
* 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
*
*
* When I made the templates I intended to import the actual model from kotlin-client
* to support https://www.ktorm.org/en/define-entities-as-any-kind-of-classes.html
* TODO: implement normal entity https://www.ktorm.org/en/entities-and-column-binding.html
*
*/
package org.openapitools.client.models
import java.io.Serializable
/**
* Describes the result of uploading an image resource
* @param code
* @param type
* @param message
*/
data class ApiResponse (
//@Json(name = "code")
val code: kotlin.Int? = null,
//@Json(name = "type")
val type: kotlin.String? = null,
//@Json(name = "message")
val message: kotlin.String? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
}

View File

@@ -0,0 +1,34 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import java.io.Serializable
/**
* A category for a pet
* @param id
* @param name
*/
data class Category (
//@Json(name = "id")
val id: kotlin.Long? = null,
//@Json(name = "name")
val name: kotlin.String? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
}

View File

@@ -0,0 +1,60 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import java.io.Serializable
/**
* An order for a pets from the pet store
* @param id
* @param petId
* @param quantity
* @param shipDate
* @param status Order Status
* @param complete
*/
data class Order (
//@Json(name = "id")
val id: kotlin.Long? = null,
//@Json(name = "petId")
val petId: kotlin.Long? = null,
//@Json(name = "quantity")
val quantity: kotlin.Int? = null,
//@Json(name = "shipDate")
val shipDate: java.time.LocalDateTime? = null, //manual fix: we don't support offsets
/* Order Status */
//@Json(name = "status")
val status: Order.Status? = null,
//@Json(name = "complete")
val complete: kotlin.Boolean? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
//@Json(name = "placed")
placed("placed"),
//@Json(name = "approved")
approved("approved"),
//@Json(name = "delivered")
delivered("delivered");
}
}

View File

@@ -0,0 +1,62 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import org.openapitools.client.models.Category
import org.openapitools.client.models.Tag
import java.io.Serializable
/**
* A pet for sale in the pet store
* @param name
* @param photoUrls
* @param id
* @param category
* @param tags
* @param status pet status in the store
*/
data class Pet (
//@Json(name = "name")
val name: kotlin.String,
//@Json(name = "photoUrls")
val photoUrls: kotlin.collections.List<kotlin.String>,
//@Json(name = "id")
val id: kotlin.Long? = null,
//@Json(name = "category")
val category: Category? = null,
//@Json(name = "tags")
val tags: kotlin.collections.List<Tag>? = null,
/* pet status in the store */
//@Json(name = "status")
val status: Pet.Status? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
//@Json(name = "available")
available("available"),
//@Json(name = "pending")
pending("pending"),
//@Json(name = "sold")
sold("sold");
}
}

View File

@@ -0,0 +1,34 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import java.io.Serializable
/**
* A tag for a pet
* @param id
* @param name
*/
data class Tag (
//@Json(name = "id")
val id: kotlin.Long? = null,
//@Json(name = "name")
val name: kotlin.String? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
}

View File

@@ -0,0 +1,53 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import java.io.Serializable
/**
* A User who is purchasing from the pet store
* @param id
* @param username
* @param firstName
* @param lastName
* @param email
* @param password
* @param phone
* @param userStatus User Status
*/
data class User (
//@Json(name = "id")
val id: kotlin.Long? = null,
//@Json(name = "username")
val username: kotlin.String? = null,
//@Json(name = "firstName")
val firstName: kotlin.String? = null,
//@Json(name = "lastName")
val lastName: kotlin.String? = null,
//@Json(name = "email")
val email: kotlin.String? = null,
//@Json(name = "password")
val password: kotlin.String? = null,
//@Json(name = "phone")
val phone: kotlin.String? = null,
/* User Status */
//@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) : Serializable {
companion object {
private const val serialVersionUID: Long = 123
}
}

View File

@@ -0,0 +1,63 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* Describes the result of uploading an image resource
* @param code
* @param type
* @param message
*/
object ApiResponses : BaseTable<ApiResponse>("ApiResponse") {
val code = int("code") /* null */
val type = text("type") /* null */
val message = text("message") /* null */
/**
* Create an entity of type ApiResponse from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = ApiResponse(
code = row[code] /* kotlin.Int? */,
type = row[type] /* kotlin.String? */,
message = row[message] /* kotlin.String? */
)
/**
* Assign all the columns from the entity of type ApiResponse to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = ApiResponse()
* database.update(ApiResponses, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: ApiResponse) {
this.apply {
set(ApiResponses.code, entity.code)
set(ApiResponses.type, entity.type)
set(ApiResponses.message, entity.message)
}
}
}

View File

@@ -0,0 +1,59 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* A category for a pet
* @param id
* @param name
*/
object Categorys : BaseTable<Category>("Category") {
val id = long("id") /* null */
val name = text("name") /* null */
/**
* Create an entity of type Category from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Category(
id = row[id] /* kotlin.Long? */,
name = row[name] /* kotlin.String? */
)
/**
* Assign all the columns from the entity of type Category to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = Category()
* database.update(Categorys, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: Category) {
this.apply {
set(Categorys.id, entity.id)
set(Categorys.name, entity.name)
}
}
}

View File

@@ -0,0 +1,76 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* An order for a pets from the pet store
* @param id
* @param petId
* @param quantity
* @param shipDate
* @param status Order Status
* @param complete
*/
object Orders : BaseTable<Order>("Order") {
val id = long("id") /* null */
val petId = long("petId") /* null */
val quantity = int("quantity") /* null */
val shipDate = datetime("shipDate") /* null */
val status = text("status").transform({ Order.Status.valueOf(it ?: "placed") }, { it.value }) /* null */ /* Order Status */
val complete = boolean("complete") /* null */
/**
* Create an entity of type Order from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Order(
id = row[id] /* kotlin.Long? */,
petId = row[petId] /* kotlin.Long? */,
quantity = row[quantity] /* kotlin.Int? */,
shipDate = row[shipDate] /* java.time.LocalDateTime? */,
status = row[status] /* kotlin.String? */ /* Order Status */,
complete = row[complete] /* kotlin.Boolean? */
)
/**
* Assign all the columns from the entity of type Order to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = Order()
* database.update(Orders, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: Order) {
this.apply {
set(Orders.id, entity.id)
set(Orders.petId, entity.petId)
set(Orders.quantity, entity.quantity)
set(Orders.shipDate, entity.shipDate)
set(Orders.status, entity.status)
set(Orders.complete, entity.complete)
}
}
}

View File

@@ -0,0 +1,104 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* A pet for sale in the pet store
* @param name
* @param photoUrls
* @param id
* @param category
* @param tags
* @param status pet status in the store
*/
object Pets : BaseTable<Pet>("Pet") {
val name = text("name")
val id = long("id") /* null */
val category = long("category") /* null */
val status = text("status").transform({ Pet.Status.valueOf(it ?: "available") }, { it.value }) /* null */ /* pet status in the store */
/**
* Create an entity of type Pet from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Pet(
name = row[name] ?: "" /* kotlin.String */,
photoUrls = emptyList() /* kotlin.Array<kotlin.String> */,
id = row[id] /* kotlin.Long? */,
category = Categorys.createEntity(row, withReferences) /* Category? */,
tags = emptyList() /* kotlin.Array<Tag>? */,
status = row[status] /* kotlin.String? */ /* pet status in the store */
)
/**
* Assign all the columns from the entity of type Pet to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = Pet()
* database.update(Pets, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: Pet) {
this.apply {
set(Pets.name, entity.name)
set(Pets.id, entity.id)
set(Pets.category, entity.category)
set(Pets.status, entity.status)
}
}
}
object PetPhotoUrls : BaseTable<Pair<kotlin.Long, kotlin.String>>("PetPhotoUrls") {
val pet = long("pet")
val photoUrls = text("photoUrls")
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean): Pair<kotlin.Long, kotlin.String> =
Pair(row[pet] ?: 0, row[photoUrls] ?: "")
fun AssignmentsBuilder.assignFrom(entity: Pair<kotlin.Long, kotlin.String>) {
this.apply {
set(PetPhotoUrls.pet, entity.first)
set(PetPhotoUrls.photoUrls, entity.second)
}
}
}
object PetTag : BaseTable<Pair<kotlin.Long, kotlin.Long>>("PetTag") {
val pet = long("pet")
val tag = long("tag")
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean): Pair<kotlin.Long, kotlin.Long> =
Pair(row[pet] ?: 0, row[tag] ?: 0)
fun AssignmentsBuilder.assignFrom(entity: Pair<kotlin.Long, kotlin.Long>) {
this.apply {
set(PetTag.pet, entity.first)
set(PetTag.tag, entity.second)
}
}
}

View File

@@ -0,0 +1,59 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* A tag for a pet
* @param id
* @param name
*/
object Tags : BaseTable<Tag>("Tag") {
val id = long("id") /* null */
val name = text("name") /* null */
/**
* Create an entity of type Tag from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Tag(
id = row[id] /* kotlin.Long? */,
name = row[name] /* kotlin.String? */
)
/**
* Assign all the columns from the entity of type Tag to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = Tag()
* database.update(Tags, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: Tag) {
this.apply {
set(Tags.id, entity.id)
set(Tags.name, entity.name)
}
}
}

View File

@@ -0,0 +1,83 @@
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.database.models
import org.ktorm.dsl.*
import org.ktorm.schema.*
import org.ktorm.database.Database
import org.openapitools.client.models.*
/**
* A User who is purchasing from the pet store
* @param id
* @param username
* @param firstName
* @param lastName
* @param email
* @param password
* @param phone
* @param userStatus User Status
*/
object Users : BaseTable<User>("User") {
val id = long("id") /* null */
val username = text("username") /* null */
val firstName = text("firstName") /* null */
val lastName = text("lastName") /* null */
val email = text("email") /* null */
val password = text("password") /* null */
val phone = text("phone") /* null */
val userStatus = int("userStatus") /* null */ /* User Status */
/**
* Create an entity of type User from the model
*/
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = User(
id = row[id] /* kotlin.Long? */,
username = row[username] /* kotlin.String? */,
firstName = row[firstName] /* kotlin.String? */,
lastName = row[lastName] /* kotlin.String? */,
email = row[email] /* kotlin.String? */,
password = row[password] /* kotlin.String? */,
phone = row[phone] /* kotlin.String? */,
userStatus = row[userStatus] /* kotlin.Int? */ /* User Status */
)
/**
* Assign all the columns from the entity of type User to the DML expression.
*
* Usage:
*
* ```kotlin
* let entity = User()
* database.update(Users, {
* assignFrom(entity)
* })
* ```
* @return the builder with the columns for the update or insert.
*/
fun AssignmentsBuilder.assignFrom(entity: User) {
this.apply {
set(Users.id, entity.id)
set(Users.username, entity.username)
set(Users.firstName, entity.firstName)
set(Users.lastName, entity.lastName)
set(Users.email, entity.email)
set(Users.password, entity.password)
set(Users.phone, entity.phone)
set(Users.userStatus, entity.userStatus)
}
}
}