Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario.RuizSanchez committed Jun 3, 2019
1 parent f02d683 commit 06c1dee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lib/open_api_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ def self.from(swagger_file, create_method_name: :operation_id, include_responses
description_parameters << "# #{dpk}: (#{dpv[:type]}) #{dpv[:description]}"
end
if dpv.keys.include?(:pattern)
data_pattern << "#{dpk}: /#{dpv[:pattern].to_s.gsub("\\/", "\/")}/"
#todo: control better the cases with back slashes
if dpv[:pattern].include?('\\/')
data_pattern << "#{dpk}: //"
else
data_pattern << "#{dpk}: /#{dpv[:pattern].to_s.gsub("\\/", "\/")}/"
end
end
if dpv.keys.include?(:readOnly) and dpv[:readOnly] == true
data_read_only << dpk
Expand Down
2 changes: 1 addition & 1 deletion lib/open_api_import/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def snake_case
# Convert to CamelCase a string
########################################################
def camel_case
return self if self !~ /_/ && self !~ /\s/ && self =~ /[A-Z]+.*/
return self if self !~ /_/ && self !~ /-/ && self !~ /\s/ && self =~ /[A-Z]+.*/

gsub(/\W/, '_')
.split('_').map(&:capitalize).join
Expand Down
4 changes: 2 additions & 2 deletions open_api_import.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'open_api_import'
s.version = '0.7.3'
s.version = '0.7.4'
s.summary = "OpenApiImport -- Import a Swagger or Open API file and create a Ruby Request Hash file including all requests and responses with all the examples. The file can be in JSON or YAML"
s.description = "OpenApiImport -- Import a Swagger or Open API file and create a Ruby Request Hash file including all requests and responses with all the examples. The file can be in JSON or YAML"
s.authors = ["Mario Ruiz"]
Expand All @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.license = 'MIT'
s.add_runtime_dependency 'oas_parser', '~> 0.16', '>= 0.16.0'
s.add_runtime_dependency 'rufo', '~> 0.4', '>= 0.4.1'
s.add_runtime_dependency 'nice_hash', '~> 1.12', '>= 1.12.4'
s.add_runtime_dependency 'nice_hash', '~> 1.12', '>= 1.12.5'
s.add_development_dependency 'rspec', '~> 3.8', '>= 3.8.0'
s.add_development_dependency 'coveralls', '~> 0.8', '>= 0.8.22'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
Expand Down

0 comments on commit 06c1dee

Please sign in to comment.