swagger2md 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/bin/swagger2md +3 -3
- data/example/input.json +1044 -0
- data/example/output.md +583 -0
- data/lib/swagger2md/converter.rb +5 -4
- data/lib/swagger2md/version.rb +1 -1
- metadata +3 -1
data/lib/swagger2md/converter.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
module Swagger2md
|
4
5
|
module Converter
|
5
|
-
def self.to_markdown
|
6
|
-
docs_file = File.read(
|
6
|
+
def self.to_markdown input_path, output_path
|
7
|
+
docs_file = File.read(input_path)
|
7
8
|
docs_hash = JSON.parse(docs_file)
|
8
9
|
content = "#{docs_hash['info']['title']}\n"\
|
9
10
|
"======\n"\
|
@@ -32,10 +33,10 @@ module Swagger2md
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
35
|
-
export(content)
|
36
|
+
export(content, output_path)
|
36
37
|
end
|
37
38
|
|
38
|
-
def self.export(content, output
|
39
|
+
def self.export(content, output)
|
39
40
|
File.open(output, 'w') do |file|
|
40
41
|
file.write(content)
|
41
42
|
end
|
data/lib/swagger2md/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagger2md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SFzxc
|
@@ -83,6 +83,8 @@ files:
|
|
83
83
|
- bin/console
|
84
84
|
- bin/setup
|
85
85
|
- bin/swagger2md
|
86
|
+
- example/input.json
|
87
|
+
- example/output.md
|
86
88
|
- lib/swagger2md.rb
|
87
89
|
- lib/swagger2md/converter.rb
|
88
90
|
- lib/swagger2md/utils.rb
|