diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JetbrainsHttpClientClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JetbrainsHttpClientClientCodegen.java index 6b8cba26fe..7db3b0de9a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JetbrainsHttpClientClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JetbrainsHttpClientClientCodegen.java @@ -89,6 +89,7 @@ public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements // Path parameters List pathParameters = operations.stream() + .filter(operation -> operation.pathParams != null) .flatMap(operation -> operation.pathParams.stream()) .collect(Collectors.toList()); @@ -101,6 +102,7 @@ public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements // Auth Methods List authMethods = operations.stream() + .filter(operation -> operation.authMethods != null) .flatMap(operation -> operation.authMethods.stream()) .collect(Collectors.toList()); diff --git a/samples/client/petstore/jetbrains/http/client/.openapi-generator-ignore b/samples/client/petstore/jetbrains/http/client/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/.openapi-generator-ignore @@ -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 diff --git a/samples/client/petstore/jetbrains/http/client/.openapi-generator/FILES b/samples/client/petstore/jetbrains/http/client/.openapi-generator/FILES new file mode 100644 index 0000000000..6fc3d59551 --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/.openapi-generator/FILES @@ -0,0 +1,5 @@ +Apis/PetApi.http +Apis/StoreApi.http +Apis/UserApi.http +Apis/http-client.env.json +README.md diff --git a/samples/client/petstore/jetbrains/http/client/.openapi-generator/VERSION b/samples/client/petstore/jetbrains/http/client/.openapi-generator/VERSION new file mode 100644 index 0000000000..717311e32e --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/samples/client/petstore/jetbrains/http/client/Apis/PetApi.http b/samples/client/petstore/jetbrains/http/client/Apis/PetApi.http new file mode 100644 index 0000000000..3fda548c89 --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/Apis/PetApi.http @@ -0,0 +1,68 @@ +## PetApi + + + +### Add a new pet to the store +### +# @name addPet +POST http://petstore.swagger.io/v2/pet + +Content-Type: application/jsonContent-Type: application/xml + + +### Deletes a pet +### +# @name deletePet +DELETE http://petstore.swagger.io/v2/pet/{{petId}} + + + + +### Finds Pets by status +### Multiple status values can be provided with comma separated strings +# @name findPetsByStatus +GET http://petstore.swagger.io/v2/pet/findByStatus + + + + +### Finds Pets by tags +### Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +# @name findPetsByTags +GET http://petstore.swagger.io/v2/pet/findByTags + + + + +### Find pet by ID +### Returns a single pet +# @name getPetById +GET http://petstore.swagger.io/v2/pet/{{petId}} +api_key: {{apiKey}} + + + +### Update an existing pet +### +# @name updatePet +PUT http://petstore.swagger.io/v2/pet + +Content-Type: application/jsonContent-Type: application/xml + + +### Updates a pet in the store with form data +### +# @name updatePetWithForm +POST http://petstore.swagger.io/v2/pet/{{petId}} + +Content-Type: application/x-www-form-urlencoded + + +### uploads an image +### +# @name uploadFile +POST http://petstore.swagger.io/v2/pet/{{petId}}/uploadImage + +Content-Type: multipart/form-data + + diff --git a/samples/client/petstore/jetbrains/http/client/Apis/StoreApi.http b/samples/client/petstore/jetbrains/http/client/Apis/StoreApi.http new file mode 100644 index 0000000000..e534b84d1d --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/Apis/StoreApi.http @@ -0,0 +1,36 @@ +## StoreApi + + + +### Delete purchase order by ID +### For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +# @name deleteOrder +DELETE http://petstore.swagger.io/v2/store/order/{{orderId}} + + + + +### Returns pet inventories by status +### Returns a map of status codes to quantities +# @name getInventory +GET http://petstore.swagger.io/v2/store/inventory +api_key: {{apiKey}} + + + +### Find purchase order by ID +### For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +# @name getOrderById +GET http://petstore.swagger.io/v2/store/order/{{orderId}} + + + + +### Place an order for a pet +### +# @name placeOrder +POST http://petstore.swagger.io/v2/store/order + +Content-Type: application/json + + diff --git a/samples/client/petstore/jetbrains/http/client/Apis/UserApi.http b/samples/client/petstore/jetbrains/http/client/Apis/UserApi.http new file mode 100644 index 0000000000..2226b44035 --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/Apis/UserApi.http @@ -0,0 +1,68 @@ +## UserApi + + + +### Create user +### This can only be done by the logged in user. +# @name createUser +POST http://petstore.swagger.io/v2/user +api_key: {{apiKey}} +Content-Type: application/json + + +### Creates list of users with given input array +### +# @name createUsersWithArrayInput +POST http://petstore.swagger.io/v2/user/createWithArray +api_key: {{apiKey}} +Content-Type: application/json + + +### Creates list of users with given input array +### +# @name createUsersWithListInput +POST http://petstore.swagger.io/v2/user/createWithList +api_key: {{apiKey}} +Content-Type: application/json + + +### Delete user +### This can only be done by the logged in user. +# @name deleteUser +DELETE http://petstore.swagger.io/v2/user/{{username}} +api_key: {{apiKey}} + + + +### Get user by user name +### +# @name getUserByName +GET http://petstore.swagger.io/v2/user/{{username}} + + + + +### Logs user into the system +### +# @name loginUser +GET http://petstore.swagger.io/v2/user/login + + + + +### Logs out current logged in user session +### +# @name logoutUser +GET http://petstore.swagger.io/v2/user/logout +api_key: {{apiKey}} + + + +### Updated user +### This can only be done by the logged in user. +# @name updateUser +PUT http://petstore.swagger.io/v2/user/{{username}} +api_key: {{apiKey}} +Content-Type: application/json + + diff --git a/samples/client/petstore/jetbrains/http/client/Apis/http-client.env.json b/samples/client/petstore/jetbrains/http/client/Apis/http-client.env.json new file mode 100644 index 0000000000..192e63d727 --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/Apis/http-client.env.json @@ -0,0 +1,10 @@ +{ + "dev" : { + "petId": "test", + "orderId": "test", + "username": "test", + "oauth2": "test", + "apiKey": "test", + "todo": "remove last comma" + } +} \ No newline at end of file diff --git a/samples/client/petstore/jetbrains/http/client/README.md b/samples/client/petstore/jetbrains/http/client/README.md new file mode 100644 index 0000000000..457eb8731d --- /dev/null +++ b/samples/client/petstore/jetbrains/http/client/README.md @@ -0,0 +1,9 @@ +# OpenAPI Petstore Jetbrains API Client + + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +* API basepath : [http://petstore.swagger.io/v2](http://petstore.swagger.io/v2) +* Version : 1.0.0 + +_This client was generated by the jetbrains-http-client of OpenAPI Generator_ \ No newline at end of file