Skip to content

Commit

Permalink
[Kotlin Server] Fix Ktor and modelMutable samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Stexxe committed Dec 6, 2024
1 parent 385e3a4 commit 2608d10
Show file tree
Hide file tree
Showing 8 changed files with 511 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "{{artifactVersion}}"

plugins {
kotlin("jvm") version "2.0.20"
id("io.ktor.plugin") version "3.0.2"
application
kotlin("plugin.serialization") version "2.0.20"
}

Expand All @@ -23,6 +23,7 @@ repositories {
}

dependencies {
implementation(platform("io.ktor:ktor-bom:3.0.2"))
implementation("ch.qos.logback:logback-classic:$logback_version")
{{#hasAuthMethods}}
implementation("com.typesafe:config:1.4.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,34 @@ README.md
api/openapi.yaml
build.gradle
build.sbt
docs/AllOfSimpleModel.md
docs/Animal.md
docs/AnyTypeTest.md
docs/ArrayOfSameRef.md
docs/Cat.md
docs/Category.md
docs/CircularReference1.md
docs/CircularReference2.md
docs/CircularReference3.md
docs/CodesEnum.md
docs/DefaultApi.md
docs/Dog.md
docs/FakeApi.md
docs/FakeWebhooksSourcesDeletedPostRequest.md
docs/FakeWebhooksSourcesDeletedPostRequestEvent.md
docs/ModelApiResponse.md
docs/OneOfStringOrInt.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md
docs/RefToRefParameterAnyofRefToAnyofParameter.md
docs/SelfReferenceAdditionalProperties.md
docs/SelfReferenceAnyOf.md
docs/SelfReferenceOneOf.md
docs/SimpleModelWithArrayProperty.md
docs/StoreApi.md
docs/StringOrInt.md
docs/Tag.md
docs/User.md
docs/UserApi.md
Expand All @@ -36,6 +58,8 @@ src/main/java/org/openapitools/client/ProgressResponseBody.java
src/main/java/org/openapitools/client/ServerConfiguration.java
src/main/java/org/openapitools/client/ServerVariable.java
src/main/java/org/openapitools/client/StringUtil.java
src/main/java/org/openapitools/client/api/DefaultApi.java
src/main/java/org/openapitools/client/api/FakeApi.java
src/main/java/org/openapitools/client/api/PetApi.java
src/main/java/org/openapitools/client/api/StoreApi.java
src/main/java/org/openapitools/client/api/UserApi.java
Expand All @@ -48,9 +72,29 @@ src/main/java/org/openapitools/client/auth/OAuthFlow.java
src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java
src/main/java/org/openapitools/client/auth/RetryingOAuth.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/AllOfSimpleModel.java
src/main/java/org/openapitools/client/model/Animal.java
src/main/java/org/openapitools/client/model/AnyTypeTest.java
src/main/java/org/openapitools/client/model/ArrayOfSameRef.java
src/main/java/org/openapitools/client/model/Cat.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/CircularReference1.java
src/main/java/org/openapitools/client/model/CircularReference2.java
src/main/java/org/openapitools/client/model/CircularReference3.java
src/main/java/org/openapitools/client/model/CodesEnum.java
src/main/java/org/openapitools/client/model/Dog.java
src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java
src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java
src/main/java/org/openapitools/client/model/ModelApiResponse.java
src/main/java/org/openapitools/client/model/OneOfStringOrInt.java
src/main/java/org/openapitools/client/model/Order.java
src/main/java/org/openapitools/client/model/Pet.java
src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java
src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java
src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java
src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java
src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java
src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java
src/main/java/org/openapitools/client/model/StringOrInt.java
src/main/java/org/openapitools/client/model/Tag.java
src/main/java/org/openapitools/client/model/User.java
46 changes: 36 additions & 10 deletions samples/client/petstore/java/okhttp-gson-3.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,20 @@ Please follow the [installation](#installation) instruction and execute the foll
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.PetApi;
import org.openapitools.client.api.FakeApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io/v2");

// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");

PetApi apiInstance = new PetApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
FakeApi apiInstance = new FakeApi(defaultClient);
try {
Pet result = apiInstance.addPet(pet);
Object result = apiInstance.fakeInlineSchemaAnyofPath1Get();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet");
System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath1Get");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
Expand All @@ -119,6 +113,18 @@ All URIs are relative to *http://petstore.swagger.io/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**fakeInlineSchemaAnyofPath1Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath1Get) | **GET** /fake/inline/schema/anyof/path1 |
*FakeApi* | [**fakeInlineSchemaAnyofPath2Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath2Get) | **GET** /fake/inline/schema/anyof/path2 |
*FakeApi* | [**fakeInlineSchemaAnyofPath3Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath3Get) | **GET** /fake/inline/schema/anyof/path3 |
*FakeApi* | [**op1**](docs/FakeApi.md#op1) | **POST** /fake/api/changeowner | op1
*FakeApi* | [**op2**](docs/FakeApi.md#op2) | **POST** /fake/api/changename | op2
*FakeApi* | [**op3**](docs/FakeApi.md#op3) | **POST** /fake/api/query/enum | op3
*FakeApi* | [**refToRefParameter**](docs/FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter |
*FakeApi* | [**refToRefParameterAnyof**](docs/FakeApi.md#refToRefParameterAnyof) | **GET** /ref/ref_to_operation_level_parameter_oneof |
*FakeApi* | [**refToRefParameterOneof**](docs/FakeApi.md#refToRefParameterOneof) | **GET** /ref/ref_to_path_level_parameter_oneof |
*FakeApi* | [**responseNoRef**](docs/FakeApi.md#responseNoRef) | **GET** /no_ref |
*FakeApi* | [**responseRefToNoRef**](docs/FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref |
*FakeApi* | [**responseRefToRef**](docs/FakeApi.md#responseRefToRef) | **GET** /ref/ref |
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
Expand All @@ -143,10 +149,30 @@ Class | Method | HTTP request | Description

## Documentation for Models

- [AllOfSimpleModel](docs/AllOfSimpleModel.md)
- [Animal](docs/Animal.md)
- [AnyTypeTest](docs/AnyTypeTest.md)
- [ArrayOfSameRef](docs/ArrayOfSameRef.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [CircularReference1](docs/CircularReference1.md)
- [CircularReference2](docs/CircularReference2.md)
- [CircularReference3](docs/CircularReference3.md)
- [CodesEnum](docs/CodesEnum.md)
- [Dog](docs/Dog.md)
- [FakeWebhooksSourcesDeletedPostRequest](docs/FakeWebhooksSourcesDeletedPostRequest.md)
- [FakeWebhooksSourcesDeletedPostRequestEvent](docs/FakeWebhooksSourcesDeletedPostRequestEvent.md)
- [ModelApiResponse](docs/ModelApiResponse.md)
- [OneOfStringOrInt](docs/OneOfStringOrInt.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [RefRefToPathLevelParameterOneofRefToOneofParameter](docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md)
- [RefToRefParameterAnyofRefToAnyofParameter](docs/RefToRefParameterAnyofRefToAnyofParameter.md)
- [SelfReferenceAdditionalProperties](docs/SelfReferenceAdditionalProperties.md)
- [SelfReferenceAnyOf](docs/SelfReferenceAnyOf.md)
- [SelfReferenceOneOf](docs/SelfReferenceOneOf.md)
- [SimpleModelWithArrayProperty](docs/SimpleModelWithArrayProperty.md)
- [StringOrInt](docs/StringOrInt.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)

Expand Down
Loading

0 comments on commit 2608d10

Please sign in to comment.