-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[kotlin] Added path sanitization in javadoc comments #20767
Open
ranger-ross
wants to merge
2
commits into
OpenAPITools:master
Choose a base branch
from
ranger-ross:kotlin-path-bugfix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
generatorName: kotlin | ||
outputDir: samples/client/others/kotlin-jvm-okhttp-path-comments | ||
library: jvm-okhttp4 | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue20618-path-comments.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client | ||
additionalProperties: | ||
artifactId: kotlin-petstore-okhttp4-path-comments | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
modules/openapi-generator/src/test/resources/3_0/kotlin/issue20618-path-comments.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# See: https://github.com/OpenAPITools/openapi-generator/pull/20618#issuecomment-2690874645 | ||
openapi: 3.0.0 | ||
servers: | ||
- url: 'https://example.org/v1' | ||
info: | ||
description: >- | ||
Example created | ||
version: 1.0.0 | ||
title: OpenAPI Stuff API created to reproduce issue | ||
license: | ||
name: Apache-2.0 | ||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html' | ||
tags: | ||
- name: stuff | ||
description: All about the stuff | ||
security: | ||
- bearerAuth: [] | ||
paths: | ||
/foo/*: | ||
get: | ||
tags: | ||
- stuff | ||
summary: Finds stuff | ||
description: Finds stuff | ||
operationId: findStuff | ||
responses: | ||
'200': | ||
description: successful operation | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
components: | ||
securitySchemes: | ||
bearerAuth: | ||
type: http | ||
scheme: bearer | ||
bearerFormat: JWT |
23 changes: 23 additions & 0 deletions
23
samples/client/others/kotlin-jvm-okhttp-path-comments/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
28 changes: 28 additions & 0 deletions
28
samples/client/others/kotlin-jvm-okhttp-path-comments/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
README.md | ||
build.gradle | ||
docs/FindStuff200Response.md | ||
docs/StuffApi.md | ||
gradle/wrapper/gradle-wrapper.jar | ||
gradle/wrapper/gradle-wrapper.properties | ||
gradlew | ||
gradlew.bat | ||
settings.gradle | ||
src/main/kotlin/org/openapitools/client/apis/StuffApi.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt | ||
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt | ||
src/main/kotlin/org/openapitools/client/models/FindStuff200Response.kt |
1 change: 1 addition & 0 deletions
1
samples/client/others/kotlin-jvm-okhttp-path-comments/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.13.0-SNAPSHOT |
66 changes: 66 additions & 0 deletions
66
samples/client/others/kotlin-jvm-okhttp-path-comments/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# org.openapitools.client - Kotlin client library for OpenAPI Stuff API created to reproduce issue | ||
|
||
Example created | ||
|
||
## Overview | ||
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. | ||
|
||
- API version: 1.0.0 | ||
- Package version: | ||
- Generator version: 7.13.0-SNAPSHOT | ||
- Build package: org.openapitools.codegen.languages.KotlinClientCodegen | ||
|
||
## Requires | ||
|
||
* Kotlin 1.7.21 | ||
* Gradle 7.5 | ||
|
||
## Build | ||
|
||
First, create the gradle wrapper script: | ||
|
||
``` | ||
gradle wrapper | ||
``` | ||
|
||
Then, run: | ||
|
||
``` | ||
./gradlew check assemble | ||
``` | ||
|
||
This runs all tests and packages the library. | ||
|
||
## Features/Implementation Notes | ||
|
||
* Supports JSON inputs/outputs, File inputs, and Form inputs. | ||
* Supports collection formats for query parameters: csv, tsv, ssv, pipes. | ||
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. | ||
* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. | ||
|
||
<a id="documentation-for-api-endpoints"></a> | ||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *https://example.org/v1* | ||
|
||
| Class | Method | HTTP request | Description | | ||
| ------------ | ------------- | ------------- | ------------- | | ||
| *StuffApi* | [**findStuff**](docs/StuffApi.md#findstuff) | **GET** /foo/* | Finds stuff | | ||
|
||
|
||
<a id="documentation-for-models"></a> | ||
## Documentation for Models | ||
|
||
- [org.openapitools.client.models.FindStuff200Response](docs/FindStuff200Response.md) | ||
|
||
|
||
<a id="documentation-for-authorization"></a> | ||
## Documentation for Authorization | ||
|
||
|
||
Authentication schemes defined for the API: | ||
<a id="bearerAuth"></a> | ||
### bearerAuth | ||
|
||
- **Type**: HTTP Bearer Token authentication (JWT) | ||
|
62 changes: 62 additions & 0 deletions
62
samples/client/others/kotlin-jvm-okhttp-path-comments/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
group 'org.openapitools' | ||
version '1.0.0' | ||
|
||
wrapper { | ||
gradleVersion = '8.7' | ||
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" | ||
} | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.9.23' | ||
ext.spotless_version = "6.25.0" | ||
|
||
repositories { | ||
maven { url "https://repo1.maven.org/maven2" } | ||
} | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" | ||
} | ||
} | ||
|
||
apply plugin: 'kotlin' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.diffplug.spotless' | ||
|
||
repositories { | ||
maven { url "https://repo1.maven.org/maven2" } | ||
} | ||
|
||
// Use spotless plugin to automatically format code, remove unused import, etc | ||
// To apply changes directly to the file, run `gradlew spotlessApply` | ||
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle | ||
spotless { | ||
// comment out below to run spotless as part of the `check` task | ||
enforceCheck false | ||
|
||
format 'misc', { | ||
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to | ||
target '.gitignore' | ||
|
||
// define the steps to apply to those files | ||
trimTrailingWhitespace() | ||
indentWithSpaces() // Takes an integer argument if you don't like 4 | ||
endWithNewline() | ||
} | ||
kotlin { | ||
ktfmt() | ||
} | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" | ||
implementation "com.squareup.moshi:moshi-kotlin:1.15.1" | ||
implementation "com.squareup.moshi:moshi-adapters:1.15.1" | ||
implementation "com.squareup.okhttp3:okhttp:4.12.0" | ||
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" | ||
} |
10 changes: 10 additions & 0 deletions
10
samples/client/others/kotlin-jvm-okhttp-path-comments/docs/FindStuff200Response.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
# FindStuff200Response | ||
|
||
## Properties | ||
| Name | Type | Description | Notes | | ||
| ------------ | ------------- | ------------- | ------------- | | ||
| **id** | **kotlin.String** | | [optional] | | ||
|
||
|
||
|
54 changes: 54 additions & 0 deletions
54
samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# StuffApi | ||
|
||
All URIs are relative to *https://example.org/v1* | ||
|
||
| Method | HTTP request | Description | | ||
| ------------- | ------------- | ------------- | | ||
| [**findStuff**](StuffApi.md#findStuff) | **GET** /foo/* | Finds stuff | | ||
|
||
|
||
<a id="findStuff"></a> | ||
# **findStuff** | ||
> FindStuff200Response findStuff() | ||
|
||
Finds stuff | ||
|
||
Finds stuff | ||
|
||
### Example | ||
```kotlin | ||
// Import classes: | ||
//import org.openapitools.client.infrastructure.* | ||
//import org.openapitools.client.models.* | ||
|
||
val apiInstance = StuffApi() | ||
try { | ||
val result : FindStuff200Response = apiInstance.findStuff() | ||
println(result) | ||
} catch (e: ClientException) { | ||
println("4xx response calling StuffApi#findStuff") | ||
e.printStackTrace() | ||
} catch (e: ServerException) { | ||
println("5xx response calling StuffApi#findStuff") | ||
e.printStackTrace() | ||
} | ||
``` | ||
|
||
### Parameters | ||
This endpoint does not need any parameter. | ||
|
||
### Return type | ||
|
||
[**FindStuff200Response**](FindStuff200Response.md) | ||
|
||
### Authorization | ||
|
||
|
||
Configure bearerAuth: | ||
ApiClient.accessToken = "" | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: Not defined | ||
- **Accept**: application/json | ||
|
Binary file added
BIN
+42.4 KB
samples/client/others/kotlin-jvm-okhttp-path-comments/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
...es/client/others/kotlin-jvm-okhttp-path-comments/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the quick fix
can we add this to the github work testing kotlin samples?