openapi_blocks 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -4
- data/README.md +99 -73
- data/README.pt-BR.md +146 -131
- data/app/controllers/openapi_blocks/spec_controller.rb +2 -2
- data/lib/openapi_blocks/auto_serialize.rb +54 -0
- data/lib/openapi_blocks/base.rb +6 -35
- data/lib/openapi_blocks/builder.rb +34 -2
- data/lib/openapi_blocks/concerns/documentable.rb +26 -0
- data/lib/openapi_blocks/concerns/schemable.rb +45 -0
- data/lib/openapi_blocks/configuration.rb +8 -1
- data/lib/openapi_blocks/controller.rb +7 -27
- data/lib/openapi_blocks/railtie.rb +10 -4
- data/lib/openapi_blocks/registry.rb +76 -0
- data/lib/openapi_blocks/serialization.rb +197 -0
- data/lib/openapi_blocks/serializer.rb +12 -182
- data/lib/openapi_blocks/spec/components.rb +6 -4
- data/lib/openapi_blocks/version.rb +1 -1
- data/lib/openapi_blocks.rb +7 -3
- metadata +11 -5
- data/lib/openapi_blocks/resource.rb +0 -20
data/lib/openapi_blocks.rb
CHANGED
|
@@ -18,13 +18,17 @@ require_relative "openapi_blocks/spec/components"
|
|
|
18
18
|
require_relative "openapi_blocks/spec/paths"
|
|
19
19
|
require_relative "openapi_blocks/spec/document"
|
|
20
20
|
require_relative "openapi_blocks/builder"
|
|
21
|
-
require_relative "openapi_blocks/serializer"
|
|
22
|
-
require_relative "openapi_blocks/base"
|
|
23
21
|
require_relative "openapi_blocks/engine"
|
|
24
22
|
require_relative "openapi_blocks/railtie"
|
|
25
23
|
require_relative "openapi_blocks/operation_builder"
|
|
26
|
-
require_relative "openapi_blocks/
|
|
24
|
+
require_relative "openapi_blocks/concerns/schemable"
|
|
25
|
+
require_relative "openapi_blocks/concerns/documentable"
|
|
26
|
+
require_relative "openapi_blocks/serialization"
|
|
27
|
+
require_relative "openapi_blocks/base"
|
|
28
|
+
require_relative "openapi_blocks/serializer"
|
|
27
29
|
require_relative "openapi_blocks/controller"
|
|
30
|
+
require_relative "openapi_blocks/registry"
|
|
31
|
+
require_relative "openapi_blocks/auto_serialize"
|
|
28
32
|
|
|
29
33
|
module OpenapiBlocks # rubocop:disable Style/Documentation
|
|
30
34
|
class Error < StandardError; end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openapi_blocks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Caio Santos
|
|
@@ -122,7 +122,9 @@ dependencies:
|
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: '2.1'
|
|
124
124
|
description: Generates OpenAPI specs automatically from ActiveRecord models, ActiveModel
|
|
125
|
-
validations and Rails routes
|
|
125
|
+
validations and Rails routes. Includes a built-in serializer ~3.6x faster than as_json,
|
|
126
|
+
Scalar and Swagger UI out of the box, and optional auto-serialization via render
|
|
127
|
+
json:. Inspired by ActiveModel::Serializer.
|
|
126
128
|
email:
|
|
127
129
|
- caio.francelinosena@gmail.com
|
|
128
130
|
executables: []
|
|
@@ -138,9 +140,12 @@ files:
|
|
|
138
140
|
- app/controllers/openapi_blocks/spec_controller.rb
|
|
139
141
|
- config/routes.rb
|
|
140
142
|
- lib/openapi_blocks.rb
|
|
143
|
+
- lib/openapi_blocks/auto_serialize.rb
|
|
141
144
|
- lib/openapi_blocks/base.rb
|
|
142
145
|
- lib/openapi_blocks/builder.rb
|
|
143
146
|
- lib/openapi_blocks/cache.rb
|
|
147
|
+
- lib/openapi_blocks/concerns/documentable.rb
|
|
148
|
+
- lib/openapi_blocks/concerns/schemable.rb
|
|
144
149
|
- lib/openapi_blocks/configuration.rb
|
|
145
150
|
- lib/openapi_blocks/configuration/contact_builder.rb
|
|
146
151
|
- lib/openapi_blocks/configuration/info_builder.rb
|
|
@@ -154,12 +159,13 @@ files:
|
|
|
154
159
|
- lib/openapi_blocks/middleware.rb
|
|
155
160
|
- lib/openapi_blocks/operation_builder.rb
|
|
156
161
|
- lib/openapi_blocks/railtie.rb
|
|
157
|
-
- lib/openapi_blocks/
|
|
162
|
+
- lib/openapi_blocks/registry.rb
|
|
158
163
|
- lib/openapi_blocks/routing/extractor.rb
|
|
159
164
|
- lib/openapi_blocks/routing/operation.rb
|
|
160
165
|
- lib/openapi_blocks/schema/extractor.rb
|
|
161
166
|
- lib/openapi_blocks/schema/types.rb
|
|
162
167
|
- lib/openapi_blocks/schema/validator.rb
|
|
168
|
+
- lib/openapi_blocks/serialization.rb
|
|
163
169
|
- lib/openapi_blocks/serializer.rb
|
|
164
170
|
- lib/openapi_blocks/spec/components.rb
|
|
165
171
|
- lib/openapi_blocks/spec/document.rb
|
|
@@ -188,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
188
194
|
- !ruby/object:Gem::Version
|
|
189
195
|
version: '0'
|
|
190
196
|
requirements: []
|
|
191
|
-
rubygems_version: 4.0.
|
|
197
|
+
rubygems_version: 4.0.3
|
|
192
198
|
specification_version: 4
|
|
193
|
-
summary:
|
|
199
|
+
summary: OpenAPI 3.0/3.1 documentation and high-performance serializer for Rails
|
|
194
200
|
test_files: []
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module OpenapiBlocks
|
|
4
|
-
class Resource < Base # rubocop:disable Style/Documentation
|
|
5
|
-
class << self
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
def infer_model
|
|
9
|
-
model_name = name
|
|
10
|
-
.gsub(/Resource$/, "")
|
|
11
|
-
.split("::")
|
|
12
|
-
.last
|
|
13
|
-
|
|
14
|
-
Object.const_get(model_name)
|
|
15
|
-
rescue NameError
|
|
16
|
-
raise Error, "Could not infer model from #{name}. Use `model ModelClass` to define it explicitly."
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|