insights-api-common 3.0.0 → 3.1.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6498652170c68a06887694e324b8864d318390fc8e5f86f827cb310111c0c71
|
4
|
+
data.tar.gz: 36bf35a644fca5018e0e4a9870bf17d7db4e4b0bf6dde2edaf9e94d17730f653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7e883f0a2d5b617892e880ad061c044afa56644e0a2e4da05e7069b45adec29e1a027e9215c001e086dc7d0fddeec0c62d3a110a63e358cb8bdea321ce9155
|
7
|
+
data.tar.gz: c12ce153ce3acfcf141a51609f93f62209c954305070b8fa24574190080e27f032f5b5ca42dbe04e88fbc3109d871570d48522f31b6d98d0077ee0531ee62c9d
|
@@ -419,7 +419,7 @@ module Insights
|
|
419
419
|
new_content = openapi_contents.dup
|
420
420
|
new_content["paths"] = build_paths.sort.to_h
|
421
421
|
new_content["components"] ||= {}
|
422
|
-
new_content["components"]["schemas"] = schemas.sort.each_with_object({})
|
422
|
+
new_content["components"]["schemas"] = schemas.merge(schema_overrides).sort.each_with_object({}) { |(name, val), h| h[name] = val || openapi_contents["components"]["schemas"][name] || {} }
|
423
423
|
new_content["components"]["parameters"] = parameters.sort.each_with_object({}) { |(name, val), h| h[name] = val || openapi_contents["components"]["parameters"][name] || {} }
|
424
424
|
File.write(openapi_file, JSON.pretty_generate(new_content) + "\n")
|
425
425
|
Insights::API::Common::GraphQL::Generator.generate(api_version, new_content) if graphql
|
@@ -438,6 +438,8 @@ module Insights
|
|
438
438
|
[key, openapi_schema_properties_value(klass_name, model, key, value)]
|
439
439
|
end
|
440
440
|
end.compact.sort.to_h
|
441
|
+
rescue NameError
|
442
|
+
openapi_contents["components"]["schemas"][klass_name]["properties"]
|
441
443
|
end
|
442
444
|
|
443
445
|
def generator_blacklist_attributes
|
@@ -472,10 +474,12 @@ module Insights
|
|
472
474
|
|
473
475
|
def build_paths
|
474
476
|
applicable_rails_routes.each_with_object({}) do |route, expected_paths|
|
475
|
-
without_format
|
476
|
-
sub_path
|
477
|
-
|
478
|
-
|
477
|
+
without_format = route.path.split("(.:format)").first
|
478
|
+
sub_path = without_format.split(base_path).last.sub(/:[_a-z]*id/, "{id}")
|
479
|
+
route_destination = route.controller.split("/").last.camelize
|
480
|
+
controller = "Api::V#{api_version.sub(".", "x")}::#{route_destination}Controller".safe_constantize
|
481
|
+
klass_name = controller.try(:presentation_name) || route_destination.singularize
|
482
|
+
verb = route.verb.downcase
|
479
483
|
primary_collection = sub_path.split("/")[1].camelize.singularize
|
480
484
|
|
481
485
|
expected_paths[sub_path] ||= {}
|
@@ -513,6 +517,10 @@ module Insights
|
|
513
517
|
|
514
518
|
def handle_custom_route_action(_route_action, _verb, _primary_collection)
|
515
519
|
end
|
520
|
+
|
521
|
+
def schema_overrides
|
522
|
+
{}
|
523
|
+
end
|
516
524
|
end
|
517
525
|
end
|
518
526
|
end
|
@@ -9,7 +9,8 @@ module Insights
|
|
9
9
|
encryption_filtered = previous.except(*encrypted_columns_set)
|
10
10
|
return encryption_filtered unless arg.key?(:prefixes)
|
11
11
|
version = api_version_from_prefix(arg[:prefixes].first)
|
12
|
-
|
12
|
+
presentation_name = self.class.try(:presentation_name) || self.class.name
|
13
|
+
schema = ::Insights::API::Common::OpenApi::Docs.instance[version].definitions[presentation_name]
|
13
14
|
attrs = encryption_filtered.slice(*schema["properties"].keys)
|
14
15
|
schema["properties"].keys.each do |name|
|
15
16
|
next if attrs[name].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insights-api-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Insights Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_tenant
|