Skip to content

[Ruby] add API info as file header to ruby templates #2008

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

Merged
merged 1 commit into from
Feb 4, 2016
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 @@ -129,6 +129,9 @@ public List<File> generate() {
if (info.getVersion() != null) {
config.additionalProperties().put("version", info.getVersion());
}
if (info.getTermsOfService() != null) {
config.additionalProperties().put("termsOfService", info.getTermsOfService());
}
}

StringBuilder hostBuilder = new StringBuilder();
Expand Down
4 changes: 4 additions & 0 deletions modules/swagger-codegen/src/main/resources/ruby/api.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

require "uri"

module {{moduleName}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

require 'date'
require 'json'
require 'logger'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

module {{moduleName}}
class ApiError < StandardError
attr_reader :code, :response_headers, :response_body
Expand Down
18 changes: 18 additions & 0 deletions modules/swagger-codegen/src/main/resources/ruby/api_info.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{#appName}}{{{appName}}}

{{/appName}}
{{#appDescription}}{{{appDescription}}}

{{/appDescription}}
{{#version}}OpenAPI spec version: {{version}}{{/version}}
{{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
Generated by: https://github.com/swagger-api/swagger-codegen.git

{{#licenseInfo}}
License: {{{licenseInfo}}}
{{#licenseUrl}}{{licenseUrl}}{{/licenseUrl}}

{{/licenseInfo}}
{{#termsOfService}}
Terms of Service: {{{termsOfService}}}
{{/termsOfService}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

require 'spec_helper'
require 'json'

Expand Down
4 changes: 4 additions & 0 deletions modules/swagger-codegen/src/main/resources/ruby/gem.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

# Common files
require '{{gemName}}/api_client'
require '{{gemName}}/api_error'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

require 'date'

module {{moduleName}}{{#models}}{{#model}}{{#description}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

require 'spec_helper'
require 'json'
require 'date'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
=begin
{{> api_info}}
=end

module {{moduleName}}
VERSION = "{{gemVersion}}"
end
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

# Common files
require 'petstore/api_client'
require 'petstore/api_error'
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/api/pet_api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require "uri"

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/api/store_api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require "uri"

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/api/user_api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require "uri"

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/api_client.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'
require 'json'
require 'logger'
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/api_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

module Petstore
class ApiError < StandardError
attr_reader :code, :response_headers, :response_body
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/models/category.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/models/order.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/models/pet.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/models/tag.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'date'

module Petstore
Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/lib/petstore/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

module Petstore
VERSION = "1.0.0"
end
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/spec/api/PetApi_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'spec_helper'
require 'json'

Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/spec/api/StoreApi_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'spec_helper'
require 'json'

Expand Down
16 changes: 16 additions & 0 deletions samples/client/petstore/ruby/spec/api/UserApi_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
=begin
Swagger Petstore

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

OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git

License: Apache 2.0
http://www.apache.org/licenses/LICENSE-2.0.html

Terms of Service: http://swagger.io/terms/

=end

require 'spec_helper'
require 'json'

Expand Down
Loading