mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-11-04 10:43:44 +00:00 
			
		
		
		
	* add test for array default value * update null return * minor fixes * move default value tests to echo api spec * add new files * remove unused files * fix enum array default, add tests * better array init * Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java Co-authored-by: Leonard Brünings <lord_damokles@gmx.net> * Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java Co-authored-by: Leonard Brünings <lord_damokles@gmx.net> * revert the fix * improve default value handling * update native samples, add tests * update samples * fix tests * use conditional test for timezone * add tests to apache http client echo api * add option to default container to null * fix map default value * minor refactoring * update samples * fix javadoc * fix pom.xml * add tests in java native echo client * add java apache client echo tests * fix test * fix test --------- Co-authored-by: Leonard Brünings <lord_damokles@gmx.net>
petstore-feign
Requirements
Building the API client library requires Maven to be installed.
Installation & Usage
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your pom.xml:
<dependency>
    <groupId>org.openapitools</groupId>
    <artifactId>petstore-feign</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>
And to use the api you can follow the examples bellow:
    //Set bearer token manually
    ApiClient apiClient = new ApiClient("petstore_auth_client");
    apiClient.setBasePath("https://localhost:8243/petstore/1/");
    apiClient.setAccessToken("TOKEN", 10000);
    //Use api key
    ApiClient apiClient = new ApiClient("api_key", "API KEY");
    apiClient.setBasePath("https://localhost:8243/petstore/1/");
    //Use http basic authentication
    ApiClient apiClient = new ApiClient("basicAuth");
    apiClient.setBasePath("https://localhost:8243/petstore/1/");
    apiClient.setCredentials("username", "password");
    //Oauth password
    ApiClient apiClient = new ApiClient("oauth_password");
    apiClient.setBasePath("https://localhost:8243/petstore/1/");
    apiClient.setOauthPassword("username", "password", "client_id", "client_secret");
    //Oauth client credentials flow
    ApiClient apiClient = new ApiClient("oauth_client_credentials");
    apiClient.setBasePath("https://localhost:8243/petstore/1/");
    apiClient.setClientCredentials("client_id", "client_secret");
    PetApi petApi = apiClient.buildClient(PetApi.class);
    Pet petById = petApi.getPetById(12345L);
    System.out.println(petById);
  }
Recommendation
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.