diff --git a/README.md b/README.md index 736164facbb2..e0cb8cf2323b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ client codegen and ui may not work correctly. To validate an api and write output to ./swagger-errors.html: ``` -./bin/validate.sh http://petstore.swagger.wordnik.com/api/resources.json "" ./swagger-errors.html +./bin/validate.sh http://petstore.swagger.wordnik.com/api/api-docs "specia-key" ./swagger-errors.html ``` ### Generating static api documentation diff --git a/samples/client/petstore/php/Swagger.php b/samples/client/petstore/php/Swagger.php index 102d2e918fb1..473d47f968f6 100644 --- a/samples/client/petstore/php/Swagger.php +++ b/samples/client/petstore/php/Swagger.php @@ -78,24 +78,23 @@ class APIClient { curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - if ($method == self::$GET) { - if (! empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - } else if ($method == self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PUT) { - $json_data = json_encode($postData); - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else { - throw new Exception('Method ' . $method . ' is not recognized.'); + if (! empty($queryParams)) { + $url = ($url . '?' . http_build_query($queryParams)); } + if ($method == self::$POST) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$PUT) { + $json_data = json_encode($postData); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$DELETE) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method != self::$GET) { + throw new Exception('Method ' . $method . ' is not recognized.'); + } curl_setopt($curl, CURLOPT_URL, $url); // Make the request diff --git a/samples/client/wordnik-api/php/wordnik/Swagger.php b/samples/client/wordnik-api/php/wordnik/Swagger.php index c8fd8e2feea3..e7b7c11fbeb1 100644 --- a/samples/client/wordnik-api/php/wordnik/Swagger.php +++ b/samples/client/wordnik-api/php/wordnik/Swagger.php @@ -78,24 +78,23 @@ class APIClient { curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - if ($method == self::$GET) { - if (! empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - } else if ($method == self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PUT) { - $json_data = json_encode($postData); - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else { - throw new Exception('Method ' . $method . ' is not recognized.'); + if (! empty($queryParams)) { + $url = ($url . '?' . http_build_query($queryParams)); } + if ($method == self::$POST) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$PUT) { + $json_data = json_encode($postData); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$DELETE) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method != self::$GET) { + throw new Exception('Method ' . $method . ' is not recognized.'); + } curl_setopt($curl, CURLOPT_URL, $url); // Make the request @@ -240,4 +239,3 @@ class APIClient { ?> - diff --git a/src/main/resources/php/Swagger.mustache b/src/main/resources/php/Swagger.mustache index 93f8e7144fae..e7b7c11fbeb1 100644 --- a/src/main/resources/php/Swagger.mustache +++ b/src/main/resources/php/Swagger.mustache @@ -78,24 +78,23 @@ class APIClient { curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - if ($method == self::$GET) { - if (! empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - } else if ($method == self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PUT) { - $json_data = json_encode($postData); - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else { - throw new Exception('Method ' . $method . ' is not recognized.'); + if (! empty($queryParams)) { + $url = ($url . '?' . http_build_query($queryParams)); } + if ($method == self::$POST) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$PUT) { + $json_data = json_encode($postData); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method == self::$DELETE) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } else if ($method != self::$GET) { + throw new Exception('Method ' . $method . ' is not recognized.'); + } curl_setopt($curl, CURLOPT_URL, $url); // Make the request