mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 03:17:09 +00:00
Issue 20804: Add java nullability annotations (#20806)
* issue-20804: Add nullability annotations to Java generated clients Motivation: Be able to use generated clients in code checked by tools like NullAway. * issue-20804: Add nullability annotations to Java generated clients Motivation: Be able to use generated clients in code checked by tools like NullAway. * issue-20804: Add nullability annotations to Java generated clients Motivation: Be able to use generated clients in code checked by tools like NullAway.
This commit is contained in:
@@ -62,7 +62,7 @@ public class PetApi {
|
||||
<tr><td> 405 </td><td> Invalid input </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public Pet addPet(Pet pet) throws ApiException {
|
||||
public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException {
|
||||
return addPetWithHttpInfo(pet).getData();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PetApi {
|
||||
<tr><td> 405 </td><td> Invalid input </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Pet> addPetWithHttpInfo(Pet pet) throws ApiException {
|
||||
public ApiResponse<Pet> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
|
||||
// Check required parameters
|
||||
if (pet == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet");
|
||||
@@ -107,7 +107,7 @@ public class PetApi {
|
||||
<tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void deletePet(Long petId, String apiKey) throws ApiException {
|
||||
public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
|
||||
deletePetWithHttpInfo(petId, apiKey);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PetApi {
|
||||
<tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
|
||||
public ApiResponse<Void> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
|
||||
// Check required parameters
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
|
||||
@@ -162,7 +162,7 @@ public class PetApi {
|
||||
<tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
|
||||
public List<Pet> findPetsByStatus(@javax.annotation.Nonnull List<String> status) throws ApiException {
|
||||
return findPetsByStatusWithHttpInfo(status).getData();
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class PetApi {
|
||||
<tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
|
||||
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status) throws ApiException {
|
||||
// Check required parameters
|
||||
if (status == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
|
||||
@@ -215,7 +215,7 @@ public class PetApi {
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
|
||||
public List<Pet> findPetsByTags(@javax.annotation.Nonnull List<String> tags) throws ApiException {
|
||||
return findPetsByTagsWithHttpInfo(tags).getData();
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class PetApi {
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
|
||||
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags) throws ApiException {
|
||||
// Check required parameters
|
||||
if (tags == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
|
||||
@@ -269,7 +269,7 @@ public class PetApi {
|
||||
<tr><td> 404 </td><td> Pet not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public Pet getPetById(Long petId) throws ApiException {
|
||||
public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException {
|
||||
return getPetByIdWithHttpInfo(petId).getData();
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public class PetApi {
|
||||
<tr><td> 404 </td><td> Pet not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
|
||||
public ApiResponse<Pet> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException {
|
||||
// Check required parameters
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
|
||||
@@ -324,7 +324,7 @@ public class PetApi {
|
||||
* API documentation for the updatePet operation
|
||||
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
|
||||
*/
|
||||
public Pet updatePet(Pet pet) throws ApiException {
|
||||
public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException {
|
||||
return updatePetWithHttpInfo(pet).getData();
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ public class PetApi {
|
||||
* API documentation for the updatePet operation
|
||||
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
|
||||
*/
|
||||
public ApiResponse<Pet> updatePetWithHttpInfo(Pet pet) throws ApiException {
|
||||
public ApiResponse<Pet> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
|
||||
// Check required parameters
|
||||
if (pet == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet");
|
||||
@@ -374,7 +374,7 @@ public class PetApi {
|
||||
<tr><td> 405 </td><td> Invalid input </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws ApiException {
|
||||
public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
|
||||
updatePetWithFormWithHttpInfo(petId, name, status);
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ public class PetApi {
|
||||
<tr><td> 405 </td><td> Invalid input </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException {
|
||||
public ApiResponse<Void> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
|
||||
// Check required parameters
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
|
||||
@@ -434,7 +434,7 @@ public class PetApi {
|
||||
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _file) throws ApiException {
|
||||
public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
|
||||
return uploadFileWithHttpInfo(petId, additionalMetadata, _file).getData();
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public class PetApi {
|
||||
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File _file) throws ApiException {
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
|
||||
// Check required parameters
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class StoreApi {
|
||||
<tr><td> 404 </td><td> Order not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void deleteOrder(String orderId) throws ApiException {
|
||||
public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException {
|
||||
deleteOrderWithHttpInfo(orderId);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class StoreApi {
|
||||
<tr><td> 404 </td><td> Order not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
|
||||
public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException {
|
||||
// Check required parameters
|
||||
if (orderId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
|
||||
@@ -145,7 +145,7 @@ public class StoreApi {
|
||||
<tr><td> 404 </td><td> Order not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public Order getOrderById(Long orderId) throws ApiException {
|
||||
public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException {
|
||||
return getOrderByIdWithHttpInfo(orderId).getData();
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class StoreApi {
|
||||
<tr><td> 404 </td><td> Order not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException {
|
||||
public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException {
|
||||
// Check required parameters
|
||||
if (orderId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
|
||||
@@ -195,7 +195,7 @@ public class StoreApi {
|
||||
<tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public Order placeOrder(Order order) throws ApiException {
|
||||
public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException {
|
||||
return placeOrderWithHttpInfo(order).getData();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class StoreApi {
|
||||
<tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Order> placeOrderWithHttpInfo(Order order) throws ApiException {
|
||||
public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException {
|
||||
// Check required parameters
|
||||
if (order == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void createUser(User user) throws ApiException {
|
||||
public void createUser(@javax.annotation.Nonnull User user) throws ApiException {
|
||||
createUserWithHttpInfo(user);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> createUserWithHttpInfo(User user) throws ApiException {
|
||||
public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException {
|
||||
// Check required parameters
|
||||
if (user == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
|
||||
@@ -101,7 +101,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void createUsersWithArrayInput(List<User> user) throws ApiException {
|
||||
public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
|
||||
createUsersWithArrayInputWithHttpInfo(user);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) throws ApiException {
|
||||
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
|
||||
// Check required parameters
|
||||
if (user == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
|
||||
@@ -143,7 +143,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void createUsersWithListInput(List<User> user) throws ApiException {
|
||||
public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
|
||||
createUsersWithListInputWithHttpInfo(user);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class UserApi {
|
||||
<tr><td> 0 </td><td> successful operation </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user) throws ApiException {
|
||||
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
|
||||
// Check required parameters
|
||||
if (user == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
|
||||
@@ -186,7 +186,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void deleteUser(String username) throws ApiException {
|
||||
public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException {
|
||||
deleteUserWithHttpInfo(username);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
|
||||
public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
|
||||
// Check required parameters
|
||||
if (username == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
|
||||
@@ -236,7 +236,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public User getUserByName(String username) throws ApiException {
|
||||
public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException {
|
||||
return getUserByNameWithHttpInfo(username).getData();
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
|
||||
public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
|
||||
// Check required parameters
|
||||
if (username == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
|
||||
@@ -287,7 +287,7 @@ public class UserApi {
|
||||
<tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public String loginUser(String username, String password) throws ApiException {
|
||||
public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
|
||||
return loginUserWithHttpInfo(username, password).getData();
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public class UserApi {
|
||||
<tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
|
||||
public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
|
||||
// Check required parameters
|
||||
if (username == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
|
||||
@@ -377,7 +377,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public void updateUser(String username, User user) throws ApiException {
|
||||
public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
|
||||
updateUserWithHttpInfo(username, user);
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ public class UserApi {
|
||||
<tr><td> 404 </td><td> User not found </td><td> - </td></tr>
|
||||
</table>
|
||||
*/
|
||||
public ApiResponse<Void> updateUserWithHttpInfo(String username, User user) throws ApiException {
|
||||
public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
|
||||
// Check required parameters
|
||||
if (username == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
|
||||
|
||||
Reference in New Issue
Block a user