From 678970807819208cf6af1653cc9fb57860792136 Mon Sep 17 00:00:00 2001 From: sm4 Date: Mon, 17 Oct 2016 21:10:33 +1100 Subject: [PATCH 1/5] added method summary under the method name --- .../swagger-codegen/src/main/resources/htmlDocs2/index.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache index c07ed7ca1e1..c65ca350268 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache @@ -216,6 +216,7 @@ function loadGoogleFontCss() {

{{nickname}}

+

{{summary}}

From 94ccee8db3d2fcff6bc9cb6d43dd19dd86dc22f2 Mon Sep 17 00:00:00 2001 From: sm4 Date: Mon, 17 Oct 2016 21:26:08 +1100 Subject: [PATCH 2/5] added batch file for html2 generation on windows --- bin/windows/html2-petstore.bat | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 bin/windows/html2-petstore.bat diff --git a/bin/windows/html2-petstore.bat b/bin/windows/html2-petstore.bat new file mode 100644 index 00000000000..5d27e249cf1 --- /dev/null +++ b/bin/windows/html2-petstore.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l html2 -o samples\html2 + +java %JAVA_OPTS% -jar %executable% %ags% From c71933ab66662158e43b27314b89db8dbc17da03 Mon Sep 17 00:00:00 2001 From: sm4 Date: Mon, 17 Oct 2016 21:27:21 +1100 Subject: [PATCH 3/5] regenerated html2 example --- samples/html2/index.html | 356 +++++++++++++++++++-------------------- 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/samples/html2/index.html b/samples/html2/index.html index 38c4970ed5e..a2360553ad5 100644 --- a/samples/html2/index.html +++ b/samples/html2/index.html @@ -702,25 +702,7 @@ var defs = {} - defs.ApiResponse = { - "type" : "object", - "properties" : { - "code" : { - "type" : "integer", - "format" : "int32" - }, - "type" : { - "type" : "string" - }, - "message" : { - "type" : "string" - } - }, - "title" : "An uploaded response", - "description" : "Describes the result of uploading an image resource" -}; defs.Category = { - "type" : "object", "properties" : { "id" : { "type" : "integer", @@ -730,14 +712,11 @@ "type" : "string" } }, - "title" : "Pet catehgry", - "description" : "A category for a pet", "xml" : { "name" : "Category" } }; defs.Order = { - "type" : "object", "properties" : { "id" : { "type" : "integer", @@ -761,18 +740,14 @@ "enum" : [ "placed", "approved", "delivered" ] }, "complete" : { - "type" : "boolean", - "default" : false + "type" : "boolean" } }, - "title" : "Pet Order", - "description" : "An order for a pets from the pet store", "xml" : { "name" : "Order" } }; defs.Pet = { - "type" : "object", "required" : [ "name", "photoUrls" ], "properties" : { "id" : { @@ -812,14 +787,11 @@ "enum" : [ "available", "pending", "sold" ] } }, - "title" : "a Pet", - "description" : "A pet for sale in the pet store", "xml" : { "name" : "Pet" } }; defs.Tag = { - "type" : "object", "properties" : { "id" : { "type" : "integer", @@ -829,14 +801,11 @@ "type" : "string" } }, - "title" : "Pet Tag", - "description" : "A tag for a pet", "xml" : { "name" : "Tag" } }; defs.User = { - "type" : "object", "properties" : { "id" : { "type" : "integer", @@ -866,8 +835,6 @@ "description" : "User Status" } }, - "title" : "a User", - "description" : "A User who is purchasing from the pet store", "xml" : { "name" : "User" } @@ -977,7 +944,7 @@

API and SDK Documentation


-

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.

+

This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters

@@ -997,6 +964,7 @@

Pet

addPet

+

Add a new pet to the store

@@ -1122,7 +1090,7 @@

Usage and SDK Samples

[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -Pet *body = ; // Pet object that needs to be added to the store +Pet *body = ; // Pet object that needs to be added to the store (optional) PetApi *apiInstance = [[PetApi alloc] init]; @@ -1147,8 +1115,9 @@

Usage and SDK Samples

var api = new .PetApi() -var body = ; // {Pet} Pet object that needs to be added to the store - +var opts = { + 'body': // {Pet} Pet object that needs to be added to the store +}; var callback = function(error, data, response) { if (error) { @@ -1157,7 +1126,7 @@

Usage and SDK Samples

console.log('API called successfully.'); } }; -api.addPet(body, callback); +api.addPet(opts, callback);
@@ -1185,7 +1154,7 @@

Usage and SDK Samples

Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store + var body = new Pet(); // Pet | Pet object that needs to be added to the store (optional) try { @@ -1244,7 +1213,7 @@

Parameters

Description - body * + body @@ -1254,7 +1223,7 @@

Parameters

"in" : "body", "name" : "body", "description" : "Pet object that needs to be added to the store", - "required" : true, + "required" : false, "schema" : { "$ref" : "#/definitions/Pet" } @@ -1393,6 +1362,7 @@

Status: 405 - Invalid input

deletePet

+

Deletes a pet

@@ -1698,6 +1668,7 @@

Parameters

var schemaWrapper = { "name" : "api_key", "in" : "header", + "description" : "", "required" : false, "type" : "string" }; @@ -1828,6 +1799,7 @@

Status: 400 - Invalid pet value

findPetsByStatus

+

Finds Pets by status

@@ -1955,7 +1927,7 @@

Usage and SDK Samples

[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -array[String] *status = ; // Status values that need to be considered for filter +array[String] *status = ; // Status values that need to be considered for filter (optional) (default to available) PetApi *apiInstance = [[PetApi alloc] init]; @@ -1983,8 +1955,9 @@

Usage and SDK Samples

var api = new .PetApi() -var status = ; // {array[String]} Status values that need to be considered for filter - +var opts = { + 'status': // {array[String]} Status values that need to be considered for filter +}; var callback = function(error, data, response) { if (error) { @@ -1993,7 +1966,7 @@

Usage and SDK Samples

console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByStatus(status, callback); +api.findPetsByStatus(opts, callback);
@@ -2021,7 +1994,7 @@

Usage and SDK Samples

Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(); - var status = new array[String](); // array[String] | Status values that need to be considered for filter + var status = new array[String](); // array[String] | Status values that need to be considered for filter (optional) (default to available) try { @@ -2083,7 +2056,7 @@

Parameters

Description - status* + status @@ -2093,14 +2066,14 @@

Parameters

"name" : "status", "in" : "query", "description" : "Status values that need to be considered for filter", - "required" : true, + "required" : false, "type" : "array", "items" : { "type" : "string", - "default" : "available", "enum" : [ "available", "pending", "sold" ] }, - "collectionFormat" : "csv" + "collectionFormat" : "multi", + "default" : "available" }; var schema = schemaWrapper; @@ -2134,6 +2107,9 @@

Status: 200 - successful operation

Schema +
  • + Response Example +
  • @@ -2163,6 +2139,15 @@

    Status: 200 - successful operation

    "items" : { "$ref" : "#/definitions/Pet" } + }, + "examples" : { + "application/json" : { + "name" : "Puma", + "type" : "Dog", + "color" : "Black", + "gender" : "Female", + "breed" : "Mixed" + } } }; var schema = schemaWrapper.schema; @@ -2201,6 +2186,9 @@

    Status: 200 - successful operation

    +
    +
    {name=Puma, type=Dog, color=Black, gender=Female, breed=Mixed}
    +
    @@ -2307,6 +2295,7 @@

    Status: 400 - Invalid status value

    findPetsByTags

    +

    Finds Pets by tags

    @@ -2434,7 +2423,7 @@

    Usage and SDK Samples

    [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -array[String] *tags = ; // Tags to filter by +array[String] *tags = ; // Tags to filter by (optional) PetApi *apiInstance = [[PetApi alloc] init]; @@ -2462,8 +2451,9 @@

    Usage and SDK Samples

    var api = new .PetApi() -var tags = ; // {array[String]} Tags to filter by - +var opts = { + 'tags': // {array[String]} Tags to filter by +}; var callback = function(error, data, response) { if (error) { @@ -2472,7 +2462,7 @@

    Usage and SDK Samples

    console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByTags(tags, callback); +api.findPetsByTags(opts, callback);
    @@ -2500,7 +2490,7 @@

    Usage and SDK Samples

    Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(); - var tags = new array[String](); // array[String] | Tags to filter by + var tags = new array[String](); // array[String] | Tags to filter by (optional) try { @@ -2562,7 +2552,7 @@

    Parameters

    Description - tags* + tags @@ -2572,12 +2562,12 @@

    Parameters

    "name" : "tags", "in" : "query", "description" : "Tags to filter by", - "required" : true, + "required" : false, "type" : "array", "items" : { "type" : "string" }, - "collectionFormat" : "csv" + "collectionFormat" : "multi" }; var schema = schemaWrapper; @@ -2784,6 +2774,7 @@

    Status: 400 - Invalid tag value

    getPetById

    +

    Find pet by ID

    @@ -2791,7 +2782,7 @@

    getPetById

    -

    Returns a single pet

    +

    Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions


    @@ -2855,6 +2846,10 @@

    Usage and SDK Samples

    public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + // Configure API key authorization: api_key ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); api_key.setApiKey("YOUR API KEY"); @@ -2862,7 +2857,7 @@

    Usage and SDK Samples

    //api_key.setApiKeyPrefix("Token"); PetApi apiInstance = new PetApi(); - Long petId = 789; // Long | ID of pet to return + Long petId = 789; // Long | ID of pet that needs to be fetched try { Pet result = apiInstance.getPetById(petId); System.out.println(result); @@ -2885,7 +2880,7 @@

    Usage and SDK Samples

    public static void main(String[] args) { PetApi apiInstance = new PetApi(); - Long petId = 789; // Long | ID of pet to return + Long petId = 789; // Long | ID of pet that needs to be fetched try { Pet result = apiInstance.getPetById(petId); System.out.println(result); @@ -2909,13 +2904,16 @@

    Usage and SDK Samples

    
     Configuration *apiConfig = [Configuration sharedConfig];
     
    +// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
    +[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
    +
     // Configure API key authorization: (authentication scheme: api_key)
     [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
     // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
     //[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"];
     
     
    -Long *petId = 789; // ID of pet to return
    +Long *petId = 789; // ID of pet that needs to be fetched
     
     PetApi *apiInstance = [[PetApi alloc] init];
     
    @@ -2937,6 +2935,10 @@ 

    Usage and SDK Samples

    var = require(''); var defaultClient = .ApiClient.instance; +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; api_key.apiKey = "YOUR API KEY" @@ -2945,7 +2947,7 @@

    Usage and SDK Samples

    var api = new .PetApi() -var petId = 789; // {Long} ID of pet to return +var petId = 789; // {Long} ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -2979,13 +2981,15 @@

    Usage and SDK Samples

    public void main() { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; // Configure API key authorization: api_key Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); var apiInstance = new PetApi(); - var petId = 789; // Long | ID of pet to return + var petId = 789; // Long | ID of pet that needs to be fetched try { @@ -3010,13 +3014,15 @@

    Usage and SDK Samples

    setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key io.swagger.client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // io.swagger.client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); $api_instance = new io.swagger.client\Api\PetApi(); -$petId = 789; // Long | ID of pet to return +$petId = 789; // Long | ID of pet that needs to be fetched try { $result = $api_instance->getPetById($petId); @@ -3054,7 +3060,7 @@

    Parameters

    var schemaWrapper = { "name" : "petId", "in" : "path", - "description" : "ID of pet to return", + "description" : "ID of pet that needs to be fetched", "required" : true, "type" : "integer", "format" : "int64" @@ -3341,6 +3347,7 @@

    Status: 404 - Pet not found

    updatePet

    +

    Update an existing pet

    @@ -3466,7 +3473,7 @@

    Usage and SDK Samples

    [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -Pet *body = ; // Pet object that needs to be added to the store +Pet *body = ; // Pet object that needs to be added to the store (optional) PetApi *apiInstance = [[PetApi alloc] init]; @@ -3491,8 +3498,9 @@

    Usage and SDK Samples

    var api = new .PetApi() -var body = ; // {Pet} Pet object that needs to be added to the store - +var opts = { + 'body': // {Pet} Pet object that needs to be added to the store +}; var callback = function(error, data, response) { if (error) { @@ -3501,7 +3509,7 @@

    Usage and SDK Samples

    console.log('API called successfully.'); } }; -api.updatePet(body, callback); +api.updatePet(opts, callback);
    @@ -3529,7 +3537,7 @@

    Usage and SDK Samples

    Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store + var body = new Pet(); // Pet | Pet object that needs to be added to the store (optional) try { @@ -3588,7 +3596,7 @@

    Parameters

    Description - body * + body @@ -3598,7 +3606,7 @@

    Parameters

    "in" : "body", "name" : "body", "description" : "Pet object that needs to be added to the store", - "required" : true, + "required" : false, "schema" : { "$ref" : "#/definitions/Pet" } @@ -3889,6 +3897,7 @@

    Status: 405 - Validation exception

    updatePetWithForm

    +

    Updates a pet in the store with form data

    @@ -3965,7 +3974,7 @@

    Usage and SDK Samples

    petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); - Long petId = 789; // Long | ID of pet that needs to be updated + String petId = petId_example; // String | ID of pet that needs to be updated String name = name_example; // String | Updated name of the pet String status = status_example; // String | Updated status of the pet try { @@ -3989,7 +3998,7 @@

    Usage and SDK Samples

    public static void main(String[] args) { PetApi apiInstance = new PetApi(); - Long petId = 789; // Long | ID of pet that needs to be updated + String petId = petId_example; // String | ID of pet that needs to be updated String name = name_example; // String | Updated name of the pet String status = status_example; // String | Updated status of the pet try { @@ -4018,7 +4027,7 @@

    Usage and SDK Samples

    [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -Long *petId = 789; // ID of pet that needs to be updated +String *petId = petId_example; // ID of pet that needs to be updated String *name = name_example; // Updated name of the pet (optional) String *status = status_example; // Updated status of the pet (optional) @@ -4047,7 +4056,7 @@

    Usage and SDK Samples

    var api = new .PetApi() -var petId = 789; // {Long} ID of pet that needs to be updated +var petId = petId_example; // {String} ID of pet that needs to be updated var opts = { 'name': name_example, // {String} Updated name of the pet @@ -4089,7 +4098,7 @@

    Usage and SDK Samples

    Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(); - var petId = 789; // Long | ID of pet that needs to be updated + var petId = petId_example; // String | ID of pet that needs to be updated var name = name_example; // String | Updated name of the pet (optional) var status = status_example; // String | Updated status of the pet (optional) @@ -4119,7 +4128,7 @@

    Usage and SDK Samples

    io.swagger.client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new io.swagger.client\Api\PetApi(); -$petId = 789; // Long | ID of pet that needs to be updated +$petId = petId_example; // String | ID of pet that needs to be updated $name = name_example; // String | Updated name of the pet $status = status_example; // String | Updated status of the pet @@ -4160,8 +4169,7 @@

    Parameters

    "in" : "path", "description" : "ID of pet that needs to be updated", "required" : true, - "type" : "integer", - "format" : "int64" + "type" : "string" }; var schema = schemaWrapper; @@ -4290,6 +4298,7 @@

    Status: 405 - Invalid input

    uploadFile

    +

    uploads an image

    @@ -4370,8 +4379,7 @@

    Usage and SDK Samples

    String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server file file = /path/to/file.txt; // file | file to upload try { - ApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); + apiInstance.uploadFile(petId, additionalMetadata, file); } catch (ApiException e) { System.err.println("Exception when calling PetApi#uploadFile"); e.printStackTrace(); @@ -4395,8 +4403,7 @@

    Usage and SDK Samples

    String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server file file = /path/to/file.txt; // file | file to upload try { - ApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); + apiInstance.uploadFile(petId, additionalMetadata, file); } catch (ApiException e) { System.err.println("Exception when calling PetApi#uploadFile"); e.printStackTrace(); @@ -4431,10 +4438,7 @@

    Usage and SDK Samples

    [apiInstance uploadFileWith:petId additionalMetadata:additionalMetadata file:file - completionHandler: ^(ApiResponse output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } + completionHandler: ^(NSError* error) { if (error) { NSLog(@"Error: %@", error); } @@ -4464,7 +4468,7 @@

    Usage and SDK Samples

    if (error) { console.error(error); } else { - console.log('API called successfully. Returned data: ' + data); + console.log('API called successfully.'); } }; api.uploadFile(petId, opts, callback); @@ -4502,8 +4506,7 @@

    Usage and SDK Samples

    try { // uploads an image - ApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - Debug.WriteLine(result); + apiInstance.uploadFile(petId, additionalMetadata, file); } catch (Exception e) { @@ -4531,8 +4534,7 @@

    Usage and SDK Samples

    $file = /path/to/file.txt; // file | file to upload try { - $result = $api_instance->uploadFile($petId, $additionalMetadata, $file); - print_r($result); + $api_instance->uploadFile($petId, $additionalMetadata, $file); } catch (Exception $e) { echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), PHP_EOL; } @@ -4599,7 +4601,7 @@

    Parameters

    Responses

    -

    Status: 200 - successful operation

    +

    Status: 0 - successful operation