Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C] Comment out error message debug #12056

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,10 @@ end:
"{{{httpMethod}}}");

{{#responses}}
if (apiClient->response_code == {{code}}) {
printf("%s\n","{{message}}");
}
// uncomment below to debug the error response
//if (apiClient->response_code == {{code}}) {
// printf("%s\n","{{message}}");
//}
{{/responses}}
{{#returnType}}
{{#returnTypeIsPrimitive}}
Expand Down
98 changes: 56 additions & 42 deletions samples/client/petstore/c/api/PetAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ PetAPI_addPet(apiClient_t *apiClient, pet_t * body )
localVarBodyParameters,
"POST");

if (apiClient->response_code == 405) {
printf("%s\n","Invalid input");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 405) {
// printf("%s\n","Invalid input");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -174,9 +175,10 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId , char * api_key )
localVarBodyParameters,
"DELETE");

if (apiClient->response_code == 400) {
printf("%s\n","Invalid pet value");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid pet value");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -242,12 +244,14 @@ PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t * status )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid status value");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid status value");
//}
cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
if(!cJSON_IsArray(PetAPIlocalVarJSON)) {
return 0;//nonprimitive container
Expand Down Expand Up @@ -324,12 +328,14 @@ PetAPI_findPetsByTags(apiClient_t *apiClient, list_t * tags )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid tag value");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid tag value");
//}
cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
if(!cJSON_IsArray(PetAPIlocalVarJSON)) {
return 0;//nonprimitive container
Expand Down Expand Up @@ -414,15 +420,18 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid ID supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","Pet not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid ID supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","Pet not found");
//}
//nonprimitive not container
cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
pet_t *elementToReturn = pet_parseFromJSON(PetAPIlocalVarJSON);
Expand Down Expand Up @@ -491,15 +500,18 @@ PetAPI_updatePet(apiClient_t *apiClient, pet_t * body )
localVarBodyParameters,
"PUT");

if (apiClient->response_code == 400) {
printf("%s\n","Invalid ID supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","Pet not found");
}
if (apiClient->response_code == 405) {
printf("%s\n","Validation exception");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid ID supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","Pet not found");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 405) {
// printf("%s\n","Validation exception");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -589,9 +601,10 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId , char * name , char
localVarBodyParameters,
"POST");

if (apiClient->response_code == 405) {
printf("%s\n","Invalid input");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 405) {
// printf("%s\n","Invalid input");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -696,9 +709,10 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId , char * additionalMetadata
localVarBodyParameters,
"POST");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
//nonprimitive not container
cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
api_response_t *elementToReturn = api_response_parseFromJSON(PetAPIlocalVarJSON);
Expand Down
56 changes: 32 additions & 24 deletions samples/client/petstore/c/api/StoreAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ StoreAPI_deleteOrder(apiClient_t *apiClient, char * orderId )
localVarBodyParameters,
"DELETE");

if (apiClient->response_code == 400) {
printf("%s\n","Invalid ID supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","Order not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid ID supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","Order not found");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -108,9 +110,10 @@ StoreAPI_getInventory(apiClient_t *apiClient)
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
//primitive return type not simple
cJSON *localVarJSON = cJSON_Parse(apiClient->dataReceived);
cJSON *VarJSON;
Expand Down Expand Up @@ -186,15 +189,18 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid ID supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","Order not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid ID supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","Order not found");
//}
//nonprimitive not container
cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON);
Expand Down Expand Up @@ -263,12 +269,14 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t * body )
localVarBodyParameters,
"POST");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid Order");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid Order");
//}
//nonprimitive not container
cJSON *StoreAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
order_t *elementToReturn = order_parseFromJSON(StoreAPIlocalVarJSON);
Expand Down
91 changes: 52 additions & 39 deletions samples/client/petstore/c/api/UserAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ UserAPI_createUser(apiClient_t *apiClient, user_t * body )
localVarBodyParameters,
"POST");

if (apiClient->response_code == 0) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 0) {
// printf("%s\n","successful operation");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -134,9 +135,10 @@ UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t * body )
localVarBodyParameters,
"POST");

if (apiClient->response_code == 0) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 0) {
// printf("%s\n","successful operation");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -224,9 +226,10 @@ UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t * body )
localVarBodyParameters,
"POST");

if (apiClient->response_code == 0) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 0) {
// printf("%s\n","successful operation");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -297,12 +300,14 @@ UserAPI_deleteUser(apiClient_t *apiClient, char * username )
localVarBodyParameters,
"DELETE");

if (apiClient->response_code == 400) {
printf("%s\n","Invalid username supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","User not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid username supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","User not found");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -361,15 +366,18 @@ UserAPI_getUserByName(apiClient_t *apiClient, char * username )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid username supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","User not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid username supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","User not found");
//}
//nonprimitive not container
cJSON *UserAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
user_t *elementToReturn = user_parseFromJSON(UserAPIlocalVarJSON);
Expand Down Expand Up @@ -453,12 +461,14 @@ UserAPI_loginUser(apiClient_t *apiClient, char * username , char * password )
localVarBodyParameters,
"GET");

if (apiClient->response_code == 200) {
printf("%s\n","successful operation");
}
if (apiClient->response_code == 400) {
printf("%s\n","Invalid username/password supplied");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 200) {
// printf("%s\n","successful operation");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid username/password supplied");
//}
//primitive return type simple
char* elementToReturn = strdup((char*)apiClient->dataReceived);

Expand Down Expand Up @@ -533,9 +543,10 @@ UserAPI_logoutUser(apiClient_t *apiClient)
localVarBodyParameters,
"GET");

if (apiClient->response_code == 0) {
printf("%s\n","successful operation");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 0) {
// printf("%s\n","successful operation");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down Expand Up @@ -602,12 +613,14 @@ UserAPI_updateUser(apiClient_t *apiClient, char * username , user_t * body )
localVarBodyParameters,
"PUT");

if (apiClient->response_code == 400) {
printf("%s\n","Invalid user supplied");
}
if (apiClient->response_code == 404) {
printf("%s\n","User not found");
}
// uncomment below to debug the error response
//if (apiClient->response_code == 400) {
// printf("%s\n","Invalid user supplied");
//}
// uncomment below to debug the error response
//if (apiClient->response_code == 404) {
// printf("%s\n","User not found");
//}
//No return type
end:
if (apiClient->dataReceived) {
Expand Down