diff --git a/bin/configs/ktorm-schema.yaml b/bin/configs/ktorm-schema.yaml index aff895cb279..d3c5beb9a33 100644 --- a/bin/configs/ktorm-schema.yaml +++ b/bin/configs/ktorm-schema.yaml @@ -1,7 +1,7 @@ generatorName: ktorm-schema outputDir: samples/schema/petstore/ktorm -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +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 \ No newline at end of file + importModelPackageName: org.openapitools.client.models diff --git a/bin/configs/nim.yaml b/bin/configs/nim.yaml index 136a92764c3..13a27a6b764 100644 --- a/bin/configs/nim.yaml +++ b/bin/configs/nim.yaml @@ -1,6 +1,6 @@ generatorName: nim outputDir: samples/client/petstore/nim -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/nim-client additionalProperties: packageName: petstore diff --git a/samples/client/petstore/nim/petstore/apis/api_pet.nim b/samples/client/petstore/nim/petstore/apis/api_pet.nim index 3644e392340..b2f77c2bdbb 100644 --- a/samples/client/petstore/nim/petstore/apis/api_pet.nim +++ b/samples/client/petstore/nim/petstore/apis/api_pet.nim @@ -39,10 +39,12 @@ template constructResult[T](response: Response): untyped = (none(T.typedesc), response) -proc addPet*(httpClient: HttpClient, body: Pet): Response = +proc addPet*(httpClient: HttpClient, pet: Pet): (Option[Pet], Response) = ## Add a new pet to the store httpClient.headers["Content-Type"] = "application/json" - httpClient.post(basepath & "/pet", $(%body)) + + let response = httpClient.post(basepath & "/pet", $(%pet)) + constructResult[Pet](response) proc deletePet*(httpClient: HttpClient, petId: int64, apiKey: string): Response = @@ -78,10 +80,12 @@ proc getPetById*(httpClient: HttpClient, petId: int64): (Option[Pet], Response) constructResult[Pet](response) -proc updatePet*(httpClient: HttpClient, body: Pet): Response = +proc updatePet*(httpClient: HttpClient, pet: Pet): (Option[Pet], Response) = ## Update an existing pet httpClient.headers["Content-Type"] = "application/json" - httpClient.put(basepath & "/pet", $(%body)) + + let response = httpClient.put(basepath & "/pet", $(%pet)) + constructResult[Pet](response) proc updatePetWithForm*(httpClient: HttpClient, petId: int64, name: string, status: string): Response = diff --git a/samples/client/petstore/nim/petstore/apis/api_store.nim b/samples/client/petstore/nim/petstore/apis/api_store.nim index 3c518e8dd31..a2f018b7cf3 100644 --- a/samples/client/petstore/nim/petstore/apis/api_store.nim +++ b/samples/client/petstore/nim/petstore/apis/api_store.nim @@ -57,10 +57,10 @@ proc getOrderById*(httpClient: HttpClient, orderId: int64): (Option[Order], Resp constructResult[Order](response) -proc placeOrder*(httpClient: HttpClient, body: Order): (Option[Order], Response) = +proc placeOrder*(httpClient: HttpClient, order: Order): (Option[Order], Response) = ## Place an order for a pet httpClient.headers["Content-Type"] = "application/json" - let response = httpClient.post(basepath & "/store/order", $(%body)) + let response = httpClient.post(basepath & "/store/order", $(%order)) constructResult[Order](response) diff --git a/samples/client/petstore/nim/petstore/apis/api_user.nim b/samples/client/petstore/nim/petstore/apis/api_user.nim index 87bef06818e..618477db595 100644 --- a/samples/client/petstore/nim/petstore/apis/api_user.nim +++ b/samples/client/petstore/nim/petstore/apis/api_user.nim @@ -38,22 +38,22 @@ template constructResult[T](response: Response): untyped = (none(T.typedesc), response) -proc createUser*(httpClient: HttpClient, body: User): Response = +proc createUser*(httpClient: HttpClient, user: User): Response = ## Create user httpClient.headers["Content-Type"] = "application/json" - httpClient.post(basepath & "/user", $(%body)) + httpClient.post(basepath & "/user", $(%user)) -proc createUsersWithArrayInput*(httpClient: HttpClient, body: seq[User]): Response = +proc createUsersWithArrayInput*(httpClient: HttpClient, user: seq[User]): Response = ## Creates list of users with given input array httpClient.headers["Content-Type"] = "application/json" - httpClient.post(basepath & "/user/createWithArray", $(%body)) + httpClient.post(basepath & "/user/createWithArray", $(%user)) -proc createUsersWithListInput*(httpClient: HttpClient, body: seq[User]): Response = +proc createUsersWithListInput*(httpClient: HttpClient, user: seq[User]): Response = ## Creates list of users with given input array httpClient.headers["Content-Type"] = "application/json" - httpClient.post(basepath & "/user/createWithList", $(%body)) + httpClient.post(basepath & "/user/createWithList", $(%user)) proc deleteUser*(httpClient: HttpClient, username: string): Response = @@ -84,8 +84,8 @@ proc logoutUser*(httpClient: HttpClient): Response = httpClient.get(basepath & "/user/logout") -proc updateUser*(httpClient: HttpClient, username: string, body: User): Response = +proc updateUser*(httpClient: HttpClient, username: string, user: User): Response = ## Updated user httpClient.headers["Content-Type"] = "application/json" - httpClient.put(basepath & fmt"/user/{username}", $(%body)) + httpClient.put(basepath & fmt"/user/{username}", $(%user))