swagger-core 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.gitmodules +3 -0
- data/.rubocop.yml +21 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +8 -0
- data/lib/swagger.rb +30 -0
- data/lib/swagger/api_declaration.rb +25 -0
- data/lib/swagger/attachable.rb +31 -0
- data/lib/swagger/builder.rb +87 -0
- data/lib/swagger/definition_section.rb +34 -0
- data/lib/swagger/loaders.rb +29 -0
- data/lib/swagger/mime_type.rb +25 -0
- data/lib/swagger/notes.md +35 -0
- data/lib/swagger/schema.rb +59 -0
- data/lib/swagger/uri.rb +10 -0
- data/lib/swagger/uri_template.rb +10 -0
- data/lib/swagger/v2/api_declaration.rb +81 -0
- data/lib/swagger/v2/api_operation.rb +56 -0
- data/lib/swagger/v2/example.rb +24 -0
- data/lib/swagger/v2/info.rb +23 -0
- data/lib/swagger/v2/parameter.rb +6 -0
- data/lib/swagger/v2/path.rb +38 -0
- data/lib/swagger/v2/response.rb +21 -0
- data/lib/swagger/version.rb +3 -0
- data/resources/schemas/json_schema/draft-04.json +150 -0
- data/resources/schemas/swagger/v2.0/schema.json +532 -0
- data/spec/fixtures/petstore-full.yaml +134 -0
- data/spec/fixtures/swagger.yaml +100 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/swagger/api_declaration_spec.rb +88 -0
- data/spec/swagger/api_operation_spec.rb +91 -0
- data/spec/swagger/info_spec.rb +76 -0
- data/spec/swagger/swagger_spec.rb +25 -0
- data/swagger-core.gemspec +31 -0
- metadata +225 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.shared_examples 'swagger loading' do
|
4
|
+
it { is_expected.to be_a_kind_of Swagger::APIDeclaration }
|
5
|
+
|
6
|
+
it 'has a swagger spec version' do
|
7
|
+
expect(subject.swagger).to eq(2.0)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Swagger do
|
12
|
+
describe '#load' do
|
13
|
+
subject(:swagger) { Swagger.load swagger_file }
|
14
|
+
|
15
|
+
context 'json' do
|
16
|
+
let(:swagger_file) { 'swagger_spec/examples/v2.0/json/petstore.json' }
|
17
|
+
include_examples 'swagger loading'
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'yaml' do
|
21
|
+
let(:swagger_file) { 'swagger_spec/examples/v2.0/yaml/petstore.yaml' }
|
22
|
+
include_examples 'swagger loading'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'swagger/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'swagger-core'
|
7
|
+
spec.version = Swagger::VERSION
|
8
|
+
spec.authors = ['Max Lincoln']
|
9
|
+
spec.email = ['max@devopsy.com']
|
10
|
+
spec.summary = 'Swagger parser for Ruby'
|
11
|
+
spec.description = <<-eos
|
12
|
+
The Swagger gem parses and provides an simple API for
|
13
|
+
[Swagger](http://swagger.io/) documents that define RESTful APIs.
|
14
|
+
eos
|
15
|
+
spec.homepage = 'https://github.com/maxlinc/swagger-rb'
|
16
|
+
spec.license = 'Apache-2.0'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'addressable', '~> 2.3'
|
24
|
+
spec.add_dependency 'hashie', '~> 3.0'
|
25
|
+
spec.add_dependency 'json-schema', '~> 2.2'
|
26
|
+
spec.add_dependency 'mime-types', '~> 2.0'
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
28
|
+
spec.add_development_dependency 'rake'
|
29
|
+
spec.add_development_dependency 'rspec'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swagger-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Max Lincoln
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: addressable
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: hashie
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json-schema
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mime-types
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.6'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.6'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: ! " The Swagger gem parses and provides an simple API for\n [Swagger](http://swagger.io/)
|
143
|
+
documents that define RESTful APIs.\n"
|
144
|
+
email:
|
145
|
+
- max@devopsy.com
|
146
|
+
executables: []
|
147
|
+
extensions: []
|
148
|
+
extra_rdoc_files: []
|
149
|
+
files:
|
150
|
+
- .gitignore
|
151
|
+
- .gitmodules
|
152
|
+
- .rubocop.yml
|
153
|
+
- .travis.yml
|
154
|
+
- Gemfile
|
155
|
+
- LICENSE.txt
|
156
|
+
- README.md
|
157
|
+
- Rakefile
|
158
|
+
- lib/swagger.rb
|
159
|
+
- lib/swagger/api_declaration.rb
|
160
|
+
- lib/swagger/attachable.rb
|
161
|
+
- lib/swagger/builder.rb
|
162
|
+
- lib/swagger/definition_section.rb
|
163
|
+
- lib/swagger/loaders.rb
|
164
|
+
- lib/swagger/mime_type.rb
|
165
|
+
- lib/swagger/notes.md
|
166
|
+
- lib/swagger/schema.rb
|
167
|
+
- lib/swagger/uri.rb
|
168
|
+
- lib/swagger/uri_template.rb
|
169
|
+
- lib/swagger/v2/api_declaration.rb
|
170
|
+
- lib/swagger/v2/api_operation.rb
|
171
|
+
- lib/swagger/v2/example.rb
|
172
|
+
- lib/swagger/v2/info.rb
|
173
|
+
- lib/swagger/v2/parameter.rb
|
174
|
+
- lib/swagger/v2/path.rb
|
175
|
+
- lib/swagger/v2/response.rb
|
176
|
+
- lib/swagger/version.rb
|
177
|
+
- resources/schemas/json_schema/draft-04.json
|
178
|
+
- resources/schemas/swagger/v2.0/schema.json
|
179
|
+
- spec/fixtures/petstore-full.yaml
|
180
|
+
- spec/fixtures/swagger.yaml
|
181
|
+
- spec/spec_helper.rb
|
182
|
+
- spec/swagger/api_declaration_spec.rb
|
183
|
+
- spec/swagger/api_operation_spec.rb
|
184
|
+
- spec/swagger/info_spec.rb
|
185
|
+
- spec/swagger/swagger_spec.rb
|
186
|
+
- swagger-core.gemspec
|
187
|
+
homepage: https://github.com/maxlinc/swagger-rb
|
188
|
+
licenses:
|
189
|
+
- Apache-2.0
|
190
|
+
post_install_message:
|
191
|
+
rdoc_options: []
|
192
|
+
require_paths:
|
193
|
+
- lib
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
segments:
|
201
|
+
- 0
|
202
|
+
hash: -4489768355737568917
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
none: false
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
segments:
|
210
|
+
- 0
|
211
|
+
hash: -4489768355737568917
|
212
|
+
requirements: []
|
213
|
+
rubyforge_project:
|
214
|
+
rubygems_version: 1.8.23.2
|
215
|
+
signing_key:
|
216
|
+
specification_version: 3
|
217
|
+
summary: Swagger parser for Ruby
|
218
|
+
test_files:
|
219
|
+
- spec/fixtures/petstore-full.yaml
|
220
|
+
- spec/fixtures/swagger.yaml
|
221
|
+
- spec/spec_helper.rb
|
222
|
+
- spec/swagger/api_declaration_spec.rb
|
223
|
+
- spec/swagger/api_operation_spec.rb
|
224
|
+
- spec/swagger/info_spec.rb
|
225
|
+
- spec/swagger/swagger_spec.rb
|