Skip to content

Commit d3a9c07

Browse files
committed
added sample as regression test
1 parent aeb13a9 commit d3a9c07

File tree

36 files changed

+1536
-0
lines changed

36 files changed

+1536
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generatorName: kotlin
2+
outputDir: samples/client/others/kotlin-jvm-okhttp-path-comments
3+
library: jvm-okhttp4
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue20618-path-comments.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
6+
additionalProperties:
7+
artifactId: kotlin-petstore-okhttp4-path-comments
8+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See: https://github.com/OpenAPITools/openapi-generator/pull/20618#issuecomment-2690874645
2+
openapi: 3.0.0
3+
servers:
4+
- url: 'https://example.org/v1'
5+
info:
6+
description: >-
7+
Example created
8+
version: 1.0.0
9+
title: OpenAPI Stuff API created to reproduce issue
10+
license:
11+
name: Apache-2.0
12+
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
13+
tags:
14+
- name: stuff
15+
description: All about the stuff
16+
security:
17+
- bearerAuth: []
18+
paths:
19+
/foo/*:
20+
get:
21+
tags:
22+
- stuff
23+
summary: Finds stuff
24+
description: Finds stuff
25+
operationId: findStuff
26+
responses:
27+
'200':
28+
description: successful operation
29+
content:
30+
application/json:
31+
schema:
32+
type: object
33+
properties:
34+
id:
35+
type: string
36+
components:
37+
securitySchemes:
38+
bearerAuth:
39+
type: http
40+
scheme: bearer
41+
bearerFormat: JWT
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
README.md
2+
build.gradle
3+
docs/FindStuff200Response.md
4+
docs/StuffApi.md
5+
gradle/wrapper/gradle-wrapper.jar
6+
gradle/wrapper/gradle-wrapper.properties
7+
gradlew
8+
gradlew.bat
9+
settings.gradle
10+
src/main/kotlin/org/openapitools/client/apis/StuffApi.kt
11+
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
12+
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
13+
src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt
14+
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
15+
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
16+
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
17+
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
18+
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
19+
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
20+
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
21+
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
22+
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
23+
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
24+
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
25+
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
26+
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
27+
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
28+
src/main/kotlin/org/openapitools/client/models/FindStuff200Response.kt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.13.0-SNAPSHOT
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# org.openapitools.client - Kotlin client library for OpenAPI Stuff API created to reproduce issue
2+
3+
Example created
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: 1.0.0
9+
- Package version:
10+
- Generator version: 7.13.0-SNAPSHOT
11+
- Build package: org.openapitools.codegen.languages.KotlinClientCodegen
12+
13+
## Requires
14+
15+
* Kotlin 1.7.21
16+
* Gradle 7.5
17+
18+
## Build
19+
20+
First, create the gradle wrapper script:
21+
22+
```
23+
gradle wrapper
24+
```
25+
26+
Then, run:
27+
28+
```
29+
./gradlew check assemble
30+
```
31+
32+
This runs all tests and packages the library.
33+
34+
## Features/Implementation Notes
35+
36+
* Supports JSON inputs/outputs, File inputs, and Form inputs.
37+
* Supports collection formats for query parameters: csv, tsv, ssv, pipes.
38+
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
39+
* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets.
40+
41+
<a id="documentation-for-api-endpoints"></a>
42+
## Documentation for API Endpoints
43+
44+
All URIs are relative to *https://example.org/v1*
45+
46+
| Class | Method | HTTP request | Description |
47+
| ------------ | ------------- | ------------- | ------------- |
48+
| *StuffApi* | [**findStuff**](docs/StuffApi.md#findstuff) | **GET** /foo/* | Finds stuff |
49+
50+
51+
<a id="documentation-for-models"></a>
52+
## Documentation for Models
53+
54+
- [org.openapitools.client.models.FindStuff200Response](docs/FindStuff200Response.md)
55+
56+
57+
<a id="documentation-for-authorization"></a>
58+
## Documentation for Authorization
59+
60+
61+
Authentication schemes defined for the API:
62+
<a id="bearerAuth"></a>
63+
### bearerAuth
64+
65+
- **Type**: HTTP Bearer Token authentication (JWT)
66+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version"
19+
}
20+
}
21+
22+
apply plugin: 'kotlin'
23+
apply plugin: 'maven-publish'
24+
apply plugin: 'com.diffplug.spotless'
25+
26+
repositories {
27+
maven { url "https://repo1.maven.org/maven2" }
28+
}
29+
30+
// Use spotless plugin to automatically format code, remove unused import, etc
31+
// To apply changes directly to the file, run `gradlew spotlessApply`
32+
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
33+
spotless {
34+
// comment out below to run spotless as part of the `check` task
35+
enforceCheck false
36+
37+
format 'misc', {
38+
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
39+
target '.gitignore'
40+
41+
// define the steps to apply to those files
42+
trimTrailingWhitespace()
43+
indentWithSpaces() // Takes an integer argument if you don't like 4
44+
endWithNewline()
45+
}
46+
kotlin {
47+
ktfmt()
48+
}
49+
}
50+
51+
test {
52+
useJUnitPlatform()
53+
}
54+
55+
dependencies {
56+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
57+
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
58+
implementation "com.squareup.moshi:moshi-kotlin:1.15.1"
59+
implementation "com.squareup.moshi:moshi-adapters:1.15.1"
60+
implementation "com.squareup.okhttp3:okhttp:4.12.0"
61+
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
62+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# FindStuff200Response
3+
4+
## Properties
5+
| Name | Type | Description | Notes |
6+
| ------------ | ------------- | ------------- | ------------- |
7+
| **id** | **kotlin.String** | | [optional] |
8+
9+
10+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# StuffApi
2+
3+
All URIs are relative to *https://example.org/v1*
4+
5+
| Method | HTTP request | Description |
6+
| ------------- | ------------- | ------------- |
7+
| [**findStuff**](StuffApi.md#findStuff) | **GET** /foo/* | Finds stuff |
8+
9+
10+
<a id="findStuff"></a>
11+
# **findStuff**
12+
> FindStuff200Response findStuff()
13+
14+
Finds stuff
15+
16+
Finds stuff
17+
18+
### Example
19+
```kotlin
20+
// Import classes:
21+
//import org.openapitools.client.infrastructure.*
22+
//import org.openapitools.client.models.*
23+
24+
val apiInstance = StuffApi()
25+
try {
26+
val result : FindStuff200Response = apiInstance.findStuff()
27+
println(result)
28+
} catch (e: ClientException) {
29+
println("4xx response calling StuffApi#findStuff")
30+
e.printStackTrace()
31+
} catch (e: ServerException) {
32+
println("5xx response calling StuffApi#findStuff")
33+
e.printStackTrace()
34+
}
35+
```
36+
37+
### Parameters
38+
This endpoint does not need any parameter.
39+
40+
### Return type
41+
42+
[**FindStuff200Response**](FindStuff200Response.md)
43+
44+
### Authorization
45+
46+
47+
Configure bearerAuth:
48+
ApiClient.accessToken = ""
49+
50+
### HTTP request headers
51+
52+
- **Content-Type**: Not defined
53+
- **Accept**: application/json
54+
Binary file not shown.

0 commit comments

Comments
 (0)