* [REQ][JAVA]: Add option to generate arrays with "uniqueItems" true as Sets rather than Lists - Update Java code generation to use sets instead of lists when uniqueItems is set to true - Add import resolution for sets - Add tests and fix broke tests resolve #5254 * Update Javascript, Perl, Python and Ruby to preserve current functionality. * Switch set implementation to LinkedHashSet * Fix missing import for uniqueItems used on param. * Fix missing import and return type for responses with uniqueItems * Fix default values for array of enum * Update generated samples * fix merge issue * Update generated samples Co-authored-by: William Cheng <wing328hk@gmail.com>
10 KiB
PetApi
All URIs are relative to http://petstore.swagger.io:80/v2
Method | HTTP request | Description |
---|---|---|
addPet | POST /pet | Add a new pet to the store |
deletePet | DELETE /pet/{petId} | Deletes a pet |
findPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
findPetsByTags | GET /pet/findByTags | Finds Pets by tags |
getPetById | GET /pet/{petId} | Find pet by ID |
updatePet | PUT /pet | Update an existing pet |
updatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
uploadFile | POST /pet/{petId}/uploadImage | uploads an image |
uploadFileWithRequiredFile | POST /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) |
addPet
addPet(body)
Add a new pet to the store
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.addPet()
.body(body).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
deletePet
deletePet(petId, apiKey)
Deletes a pet
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.deletePet()
.petIdPath(petId).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | Pet id to delete | |
apiKey | String | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
findPetsByStatus
List<Pet> findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.findPetsByStatus()
.statusQuery(status).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | List<String> | Status values that need to be considered for filter | [default to new ArrayList<String>()] [enum: available, pending, sold] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
findPetsByTags
Set<Pet> findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.findPetsByTags()
.tagsQuery(tags).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | Set<String> | Tags to filter by | [default to new LinkedHashSet<String>()] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
getPetById
Pet getPetById(petId)
Find pet by ID
Returns a single pet
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.getPetById()
.petIdPath(petId).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet to return |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
updatePet
updatePet(body)
Update an existing pet
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.updatePet()
.body(body).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
updatePetWithForm
updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.updatePetWithForm()
.petIdPath(petId).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet that needs to be updated | |
name | String | Updated name of the pet | [optional] |
status | String | Updated status of the pet | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
uploadFile
ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.uploadFile()
.petIdPath(petId).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet to update | |
additionalMetadata | String | Additional data to pass to server | [optional] |
file | File | file to upload | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
uploadFileWithRequiredFile
ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata)
uploads an image (required)
Example
// Import classes:
//import org.openapitools.client.ApiClient;
//import io.restassured.builder.RequestSpecBuilder;
//import io.restassured.filter.log.ErrorLoggingFilter;
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
() -> new RequestSpecBuilder()
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
api.uploadFileWithRequiredFile()
.petIdPath(petId)
.requiredFileMultiPart(requiredFile).execute(r -> r.prettyPeek());
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet to update | |
requiredFile | File | file to upload | |
additionalMetadata | String | Additional data to pass to server | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json