forked from loafle/openapi-generator-original
[Test] Migrate samples from 2.0 Spec to 3.0 spec (#9347)
* nim petstore to use 3.0 spec * ktorm to use 3.0 spec * update c petstore to use 3.0 spec * Revert "update c petstore to use 3.0 spec" This reverts commit a8ff0517bacc52fd9ac945f5812a8c12294fc410.
This commit is contained in:
parent
5d946289ef
commit
18cdb36d3e
@ -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
|
||||
importModelPackageName: org.openapitools.client.models
|
||||
|
@ -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
|
||||
|
@ -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 =
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user