better npe handling when processing openapi 3.1 spec

This commit is contained in:
William Cheng
2024-01-13 11:21:08 +08:00
parent 75ef9e0b02
commit c6efe8810d
6 changed files with 445 additions and 3 deletions

View File

@@ -72,6 +72,240 @@ public class FakeApi {
this.localCustomBaseUrl = customBaseUrl;
}
/**
* Build call for op1
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call op1Call(final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/api/changeowner";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call op1ValidateBeforeCall(final ApiCallback _callback) throws ApiException {
return op1Call(_callback);
}
/**
* op1
*
* @return Object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public Object op1() throws ApiException {
ApiResponse<Object> localVarResp = op1WithHttpInfo();
return localVarResp.getData();
}
/**
* op1
*
* @return ApiResponse&lt;Object&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public ApiResponse<Object> op1WithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = op1ValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* op1 (asynchronously)
*
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call op1Async(final ApiCallback<Object> _callback) throws ApiException {
okhttp3.Call localVarCall = op1ValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for op2
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call op2Call(final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/api/changename";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call op2ValidateBeforeCall(final ApiCallback _callback) throws ApiException {
return op2Call(_callback);
}
/**
* op2
*
* @return Object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public Object op2() throws ApiException {
ApiResponse<Object> localVarResp = op2WithHttpInfo();
return localVarResp.getData();
}
/**
* op2
*
* @return ApiResponse&lt;Object&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public ApiResponse<Object> op2WithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = op2ValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* op2 (asynchronously)
*
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 201 </td><td> Successful Response </td><td> - </td></tr>
<tr><td> 422 </td><td> Validation Error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call op2Async(final ApiCallback<Object> _callback) throws ApiException {
okhttp3.Call localVarCall = op2ValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for refToRefParameter
* @param refToUuid to test ref to parameter (uuid) (required)