From 4ea44882125fc3d041d31bc53d8905baed81802e Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 31 Aug 2016 15:57:04 +0800 Subject: [PATCH] remove unnecessary change for ruby codegen --- .../codegen/languages/RubyClientCodegen.java | 8 +++++++ .../src/main/resources/ruby/README.mustache | 2 ++ .../options/RubyClientOptionsProvider.java | 1 + samples/client/petstore/ruby/README.md | 21 +++++++++---------- .../ruby/lib/petstore/configuration.rb | 16 +++++++------- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index eaf83992b5ff..342674e62b16 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -156,12 +156,20 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { cliOptions.add(new CliOption(GEM_AUTHOR_EMAIL, "gem author email (only one is supported).")); + cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated"). + defaultValue(Boolean.TRUE.toString())); + } @Override public void processOpts() { super.processOpts(); + // default HIDE_GENERATION_TIMESTAMP to true + if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) { + additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString()); + } + if (additionalProperties.containsKey(GEM_NAME)) { setGemName((String) additionalProperties.get(GEM_NAME)); } diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index 076192b75ce4..abf26eeceda0 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -10,7 +10,9 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: {{appVersion}} - Package version: {{gemVersion}} +{{^hideGenerationTimestamp}} - Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} - Build package: {{generatorClass}} {{#infoUrl}} For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/RubyClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/RubyClientOptionsProvider.java index 64e388d38ef6..55c81e6fdc4f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/RubyClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/RubyClientOptionsProvider.java @@ -39,6 +39,7 @@ public class RubyClientOptionsProvider implements OptionsProvider { .put(RubyClientCodegen.GEM_AUTHOR_EMAIL, GEM_AUTHOR_EMAIL_VALUE) .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .build(); } diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 8f12077a3352..188335045f60 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,6 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-08-29T14:24:29.182-07:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -137,6 +136,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### http_basic_test + +- **Type**: HTTP basic authentication + ### petstore_auth - **Type**: OAuth @@ -146,13 +155,3 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets -### http_basic_test - -- **Type**: HTTP basic authentication - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 04679eac77bd..64166258b470 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -201,12 +201,12 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'petstore_auth' => + 'api_key' => { - type: 'oauth2', + type: 'api_key', in: 'header', - key: 'Authorization', - value: "Bearer #{access_token}" + key: 'api_key', + value: api_key_with_prefix('api_key') }, 'http_basic_test' => { @@ -215,12 +215,12 @@ module Petstore key: 'Authorization', value: basic_auth_token }, - 'api_key' => + 'petstore_auth' => { - type: 'api_key', + type: 'oauth2', in: 'header', - key: 'api_key', - value: api_key_with_prefix('api_key') + key: 'Authorization', + value: "Bearer #{access_token}" }, } end