mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
Add null checks on code
This commit is contained in:
@@ -89,6 +89,7 @@ public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements
|
||||
|
||||
// Path parameters
|
||||
List<CodegenParameter> 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<CodegenSecurity> authMethods = operations.stream()
|
||||
.filter(operation -> operation.authMethods != null)
|
||||
.flatMap(operation -> operation.authMethods.stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
Apis/PetApi.http
|
||||
Apis/StoreApi.http
|
||||
Apis/UserApi.http
|
||||
Apis/http-client.env.json
|
||||
README.md
|
||||
@@ -0,0 +1 @@
|
||||
unset
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"dev" : {
|
||||
"petId": "test",
|
||||
"orderId": "test",
|
||||
"username": "test",
|
||||
"oauth2": "test",
|
||||
"apiKey": "test",
|
||||
"todo": "remove last comma"
|
||||
}
|
||||
}
|
||||
9
samples/client/petstore/jetbrains/http/client/README.md
Normal file
9
samples/client/petstore/jetbrains/http/client/README.md
Normal file
@@ -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_
|
||||
Reference in New Issue
Block a user