Skip to content

Commit

Permalink
Generate sample 'ktorm-schema' project with mutable models
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed Jan 27, 2022
1 parent 3d61382 commit de65993
Show file tree
Hide file tree
Showing 20 changed files with 897 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/configs/ktorm-schema-modelMutable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: ktorm-schema
outputDir: samples/schema/petstore/ktorm-modelMutable
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/ktorm-schema
additionalProperties:
hideGenerationTimestamp: true
importModelPackageName: org.openapitools.client.models
modelMutable: "true"
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.4.0-SNAPSHOT
29 changes: 29 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/README.md
Original file line number Diff line number Diff line change
@@ -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)

35 changes: 35 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
15 changes: 15 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/ApiResponse.md
Original file line number Diff line number Diff line change
@@ -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]





13 changes: 13 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/Category.md
Original file line number Diff line number Diff line change
@@ -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]




21 changes: 21 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/Order.md
Original file line number Diff line number Diff line change
@@ -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**](#Status) | Order Status | [optional]
**complete** | complete | boolean | | **kotlin.Boolean** | | [optional]








41 changes: 41 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/Pet.md
Original file line number Diff line number Diff line change
@@ -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**](#Status) | 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*




13 changes: 13 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/Tag.md
Original file line number Diff line number Diff line change
@@ -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]




25 changes: 25 additions & 0 deletions samples/schema/petstore/ktorm-modelMutable/docs/User.md
Original file line number Diff line number Diff line change
@@ -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]










Loading

0 comments on commit de65993

Please sign in to comment.