Skip to content

Commit 5d74cdf

Browse files
committed
Generated kotlin-allOff-discriminator-kotlinx-serialization sample
1 parent ae65f53 commit 5d74cdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1788
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
README.md
2+
build.gradle
3+
docs/Animal.md
4+
docs/Bird.md
5+
docs/BirdApi.md
6+
gradle/wrapper/gradle-wrapper.jar
7+
gradle/wrapper/gradle-wrapper.properties
8+
gradlew
9+
gradlew.bat
10+
proguard-rules.pro
11+
settings.gradle
12+
src/main/kotlin/org/openapitools/client/apis/BirdApi.kt
13+
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
14+
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
15+
src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt
16+
src/main/kotlin/org/openapitools/client/infrastructure/AtomicBooleanAdapter.kt
17+
src/main/kotlin/org/openapitools/client/infrastructure/AtomicIntegerAdapter.kt
18+
src/main/kotlin/org/openapitools/client/infrastructure/AtomicLongAdapter.kt
19+
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
20+
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
21+
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
22+
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
23+
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
24+
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
25+
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
26+
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
27+
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
28+
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
29+
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
30+
src/main/kotlin/org/openapitools/client/infrastructure/StringBuilderAdapter.kt
31+
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
32+
src/main/kotlin/org/openapitools/client/infrastructure/URLAdapter.kt
33+
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
34+
src/main/kotlin/org/openapitools/client/models/Animal.kt
35+
src/main/kotlin/org/openapitools/client/models/Bird.kt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.15.0-SNAPSHOT
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# org.openapitools.client - Kotlin client library for Example
2+
3+
An example
4+
5+
## Overview
6+
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client.
7+
8+
- API version: 0.1
9+
- Package version:
10+
- Generator version: 7.15.0-SNAPSHOT
11+
- Build package: org.openapitools.codegen.languages.KotlinClientCodegen
12+
For more information, please visit [https://example.org](https://example.org)
13+
14+
## Requires
15+
16+
* Kotlin 1.7.21
17+
* Gradle 7.5
18+
19+
## Build
20+
21+
First, create the gradle wrapper script:
22+
23+
```
24+
gradle wrapper
25+
```
26+
27+
Then, run:
28+
29+
```
30+
./gradlew check assemble
31+
```
32+
33+
This runs all tests and packages the library.
34+
35+
## Features/Implementation Notes
36+
37+
* Supports JSON inputs/outputs, File inputs, and Form inputs.
38+
* Supports collection formats for query parameters: csv, tsv, ssv, pipes.
39+
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
40+
* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets.
41+
42+
<a id="documentation-for-api-endpoints"></a>
43+
## Documentation for API Endpoints
44+
45+
All URIs are relative to *http://example.org*
46+
47+
| Class | Method | HTTP request | Description |
48+
| ------------ | ------------- | ------------- | ------------- |
49+
| *BirdApi* | [**getBird**](docs/BirdApi.md#getbird) | **GET** /v1/bird/{id} | |
50+
51+
52+
<a id="documentation-for-models"></a>
53+
## Documentation for Models
54+
55+
- [org.openapitools.client.models.Animal](docs/Animal.md)
56+
- [org.openapitools.client.models.Bird](docs/Bird.md)
57+
58+
59+
<a id="documentation-for-authorization"></a>
60+
## Documentation for Authorization
61+
62+
Endpoints do not require authorization.
63+
64+
65+
66+
## Author
67+
68+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
group 'org.openapitools'
2+
version '1.0.0'
3+
4+
wrapper {
5+
gradleVersion = '8.7'
6+
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
7+
}
8+
9+
buildscript {
10+
ext.kotlin_version = '1.9.23'
11+
ext.spotless_version = "6.25.0"
12+
13+
repositories {
14+
maven { url "https://repo1.maven.org/maven2" }
15+
}
16+
dependencies {
17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18+
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
19+
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version"
20+
}
21+
}
22+
23+
apply plugin: 'kotlin'
24+
apply plugin: 'kotlinx-serialization'
25+
apply plugin: 'maven-publish'
26+
apply plugin: 'com.diffplug.spotless'
27+
28+
repositories {
29+
maven { url "https://repo1.maven.org/maven2" }
30+
}
31+
32+
// Use spotless plugin to automatically format code, remove unused import, etc
33+
// To apply changes directly to the file, run `gradlew spotlessApply`
34+
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
35+
spotless {
36+
// comment out below to run spotless as part of the `check` task
37+
enforceCheck false
38+
39+
format 'misc', {
40+
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
41+
target '.gitignore'
42+
43+
// define the steps to apply to those files
44+
trimTrailingWhitespace()
45+
indentWithSpaces() // Takes an integer argument if you don't like 4
46+
endWithNewline()
47+
}
48+
kotlin {
49+
ktfmt()
50+
}
51+
}
52+
53+
test {
54+
useJUnitPlatform()
55+
}
56+
57+
dependencies {
58+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
59+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"
60+
implementation "com.squareup.okhttp3:okhttp:4.12.0"
61+
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
62+
}
63+
64+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
65+
kotlinOptions {
66+
freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
67+
}
68+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# Animal
3+
4+
## Properties
5+
| Name | Type | Description | Notes |
6+
| ------------ | ------------- | ------------- | ------------- |
7+
| **id** | [**java.util.UUID**](java.util.UUID.md) | | |
8+
| **optionalProperty** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] |
9+
10+
11+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# Bird
3+
4+
## Properties
5+
| Name | Type | Description | Notes |
6+
| ------------ | ------------- | ------------- | ------------- |
7+
| **featherType** | **kotlin.String** | | |
8+
9+
10+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# BirdApi
2+
3+
All URIs are relative to *http://example.org*
4+
5+
| Method | HTTP request | Description |
6+
| ------------- | ------------- | ------------- |
7+
| [**getBird**](BirdApi.md#getBird) | **GET** /v1/bird/{id} | |
8+
9+
10+
<a id="getBird"></a>
11+
# **getBird**
12+
> Bird getBird(id)
13+
14+
15+
16+
### Example
17+
```kotlin
18+
// Import classes:
19+
//import org.openapitools.client.infrastructure.*
20+
//import org.openapitools.client.models.*
21+
22+
val apiInstance = BirdApi()
23+
val id : java.util.UUID = 38400000-8cf0-11bd-b23e-10b96e4ef00d // java.util.UUID |
24+
try {
25+
val result : Bird = apiInstance.getBird(id)
26+
println(result)
27+
} catch (e: ClientException) {
28+
println("4xx response calling BirdApi#getBird")
29+
e.printStackTrace()
30+
} catch (e: ServerException) {
31+
println("5xx response calling BirdApi#getBird")
32+
e.printStackTrace()
33+
}
34+
```
35+
36+
### Parameters
37+
| Name | Type | Description | Notes |
38+
| ------------- | ------------- | ------------- | ------------- |
39+
| **id** | **java.util.UUID**| | |
40+
41+
### Return type
42+
43+
[**Bird**](Bird.md)
44+
45+
### Authorization
46+
47+
No authorization required
48+
49+
### HTTP request headers
50+
51+
- **Content-Type**: Not defined
52+
- **Accept**: application/json
53+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)