rswag_json_loader 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +8 -0
- data/lib/helpers/rswag_json_loader_config.rb +25 -0
- data/lib/rswag_json_loader/version.rb +5 -0
- data/lib/rswag_json_loader.rb +29 -0
- data/lib/schema_loader.rb +13 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf033d1d25c1b9c51a9d2c94b207083fb98ac9eb36a6d8c19a37ac1f227fd95b
|
4
|
+
data.tar.gz: eca584d0039102f80d56399d1776561020de819cdfeecc1ec2a0fd03c7a1672e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9c8713d307347c8820b87246185cd232404932d759b7a9ddd44651e1eb01aeb847caa6bdbe109499e8a0cdbc5b0f54d3b6ec536bb3d8c2f4578c3f38cab61891
|
7
|
+
data.tar.gz: d61f091f7a8efa77aafb894c0f2131f38af98450e08295abb58bc6b453e08f0af4970c9294346184795cb022fc32089684a6310112dbba06277be42837e3e6b4
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module RswagJsonLoaderConfig
|
2
|
+
def configuration
|
3
|
+
yield self
|
4
|
+
end
|
5
|
+
|
6
|
+
def define_setting(name, default = nil)
|
7
|
+
class_variable_set("@@#{name}", default)
|
8
|
+
|
9
|
+
define_class_method "#{name}=" do |value|
|
10
|
+
class_variable_set("@@#{name}", value)
|
11
|
+
end
|
12
|
+
|
13
|
+
define_class_method name do
|
14
|
+
class_variable_get("@@#{name}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def define_class_method(name, &block)
|
21
|
+
(class << self; self; end).instance_eval do
|
22
|
+
define_method name, &block
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "json_schemer"
|
2
|
+
require "helpers/rswag_json_loader_config"
|
3
|
+
require "schema_loader"
|
4
|
+
|
5
|
+
module RswagJsonLoader
|
6
|
+
extend RswagJsonLoaderConfig
|
7
|
+
|
8
|
+
define_setting :schema_path, "./spec/requests/api/schemas/json/*.json"
|
9
|
+
define_setting :openapi_path, "v1/openapi.json"
|
10
|
+
|
11
|
+
class SchemaHandler
|
12
|
+
def self.json_schemas
|
13
|
+
schemas = {}
|
14
|
+
|
15
|
+
Dir[RswagJsonLoader.schema_path].each do |json|
|
16
|
+
file_name = File.basename(json, ".json")
|
17
|
+
humanized = file_name.split("_").map(&:capitalize).join
|
18
|
+
schemas[humanized] = Schemas::Loader.new(json).load
|
19
|
+
end
|
20
|
+
schemas
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.setup!
|
24
|
+
RSpec.configure do |config|
|
25
|
+
config.swagger_docs[RswagJsonLoader.openapi_path][:components][:schemas].merge!(json_schemas)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rswag_json_loader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matija Munjakovic
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json_schemer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.18
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.18
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rswag-specs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.6.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.6.0
|
41
|
+
description: Load JSON schemas into RSwag's Swagger/OpenAPI spec
|
42
|
+
email:
|
43
|
+
- matija@kodius.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- Rakefile
|
49
|
+
- lib/helpers/rswag_json_loader_config.rb
|
50
|
+
- lib/rswag_json_loader.rb
|
51
|
+
- lib/rswag_json_loader/version.rb
|
52
|
+
- lib/schema_loader.rb
|
53
|
+
homepage: https://github.com/kodius/rswag_json_loader
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata:
|
57
|
+
allowed_push_host: https://rubygems.org
|
58
|
+
homepage_uri: https://github.com/kodius/rswag_json_loader
|
59
|
+
source_code_uri: https://github.com/kodius/rswag_json_loader
|
60
|
+
changelog_uri: https://github.com/kodius/rswag_json_loader/releases
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.6.0
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubygems_version: 3.4.14
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Rswag JSON schema loader
|
80
|
+
test_files: []
|