ree_lib 1.0.93 → 1.0.95

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +41 -36
  4. data/lib/ree_lib/packages/ree_dao/package/ree_dao/wrappers/pg_array.rb +34 -26
  5. data/lib/ree_lib/packages/ree_dao/package/ree_dao/wrappers/pg_jsonb.rb +35 -25
  6. data/lib/ree_lib/packages/ree_enum/package/ree_enum/base_enum_mapper.rb +6 -18
  7. data/lib/ree_lib/packages/ree_enum/package/ree_enum/integer_value_enum_mapper.rb +6 -18
  8. data/lib/ree_lib/packages/ree_enum/package/ree_enum/string_value_enum_mapper.rb +6 -18
  9. data/lib/ree_lib/packages/ree_errors/Package.schema.json +10 -7
  10. data/lib/ree_lib/packages/ree_errors/package/ree_errors/auth_error.rb +8 -8
  11. data/lib/ree_lib/packages/ree_errors/package/ree_errors/build_error.rb +4 -2
  12. data/lib/ree_lib/packages/ree_errors/package/ree_errors/conflict_error.rb +8 -8
  13. data/lib/ree_lib/packages/ree_errors/package/ree_errors/error.rb +89 -6
  14. data/lib/ree_lib/packages/ree_errors/package/ree_errors/invalid_param_error.rb +9 -9
  15. data/lib/ree_lib/packages/ree_errors/package/ree_errors/not_found_error.rb +8 -8
  16. data/lib/ree_lib/packages/ree_errors/package/ree_errors/payment_required_error.rb +8 -8
  17. data/lib/ree_lib/packages/ree_errors/package/ree_errors/permission_error.rb +8 -8
  18. data/lib/ree_lib/packages/ree_errors/package/ree_errors/validation_error.rb +8 -8
  19. data/lib/ree_lib/packages/ree_errors/package/ree_errors.rb +1 -0
  20. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/auth_error.schema.json +24 -1
  21. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/build_error.schema.json +10 -0
  22. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/conflict_error.schema.json +24 -1
  23. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/invalid_param_error.schema.json +24 -1
  24. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/not_found_error.schema.json +24 -1
  25. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/payment_required_error.schema.json +24 -1
  26. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/permission_error.schema.json +24 -1
  27. data/lib/ree_lib/packages/ree_errors/schemas/ree_errors/validation_error.schema.json +24 -1
  28. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb +22 -8
  29. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/invalid_param_error_spec.rb +3 -1
  30. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/locales/en.yml +6 -1
  31. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/not_found_error_spec.rb +3 -1
  32. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/payment_required_error_spec.rb +3 -1
  33. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/permission_error_spec.rb +3 -1
  34. data/lib/ree_lib/packages/ree_errors/spec/ree_errors/validation_error_spec.rb +3 -1
  35. data/lib/ree_lib/packages/ree_i18n/Package.schema.json +7 -0
  36. data/lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/check_locale_exists.rb +12 -0
  37. data/lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/check_locale_exists.schema.json +33 -0
  38. data/lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/check_locale_exists.rb +16 -0
  39. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/errors/error_with_location.rb +47 -14
  40. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/field.rb +1 -1
  41. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/fields_filter.rb +11 -20
  42. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/mapper.rb +36 -48
  43. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/abstract_type.rb +2 -2
  44. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/any.rb +8 -8
  45. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/bool.rb +12 -12
  46. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/date.rb +14 -14
  47. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/date_time.rb +13 -13
  48. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/float.rb +14 -14
  49. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/integer.rb +13 -13
  50. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/rational.rb +14 -14
  51. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/string.rb +12 -12
  52. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/time.rb +13 -13
  53. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/wrappers/array.rb +88 -80
  54. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/benchmarks/mapper_benchmark_spec.rb +41 -1
  55. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/mapper_factory_spec.rb +17 -6
  56. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/hash_spec.rb +1 -1
  57. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/type_options_spec.rb +7 -26
  58. data/lib/ree_lib/packages/ree_roda/spec/ree_roda/services/build_swagger_from_routes_spec.rb +7 -4
  59. data/lib/ree_lib/packages/ree_roda/spec/ree_roda/services/locales/en.yml +3 -1
  60. data/lib/ree_lib/packages/ree_string/package/ree_string/functions/deconstantize.rb +1 -1
  61. data/lib/ree_lib/packages/ree_swagger/Package.schema.json +3 -0
  62. data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/functions/build_parameters.rb +2 -1
  63. data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/functions/build_request_body_schema.rb +12 -5
  64. data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/functions/build_serializer_schema.rb +12 -5
  65. data/lib/ree_lib/packages/ree_swagger/package/ree_swagger.rb +1 -0
  66. data/lib/ree_lib/packages/ree_swagger/schemas/ree_swagger/functions/build_parameters.schema.json +8 -0
  67. data/lib/ree_lib/packages/ree_swagger/schemas/ree_swagger/functions/build_request_body_schema.schema.json +1 -1
  68. data/lib/ree_lib/packages/ree_swagger/schemas/ree_swagger/functions/build_serializer_schema.schema.json +1 -1
  69. data/lib/ree_lib/version.rb +1 -1
  70. metadata +5 -3
  71. data/lib/ree_lib/packages/ree_errors/package/ree_errors/error_factory.rb +0 -15
@@ -7,14 +7,14 @@ class ReeSwagger::BuildSerializerSchema
7
7
  link :get_serializer_definition
8
8
  end
9
9
 
10
- contract(ReeMapper::Mapper, ArrayOf[ReeMapper::FieldsFilter] => Nilor[Hash])
11
- def call(mapper, fields_filters = [])
10
+ contract(ReeMapper::Mapper, Nilor[ArrayOf[ReeMapper::FieldsFilter]] => Nilor[Hash])
11
+ def call(mapper, fields_filters = nil)
12
12
  if mapper.type
13
13
  return get_serializer_definition(mapper.type, method(:call).to_proc)
14
14
  end
15
15
 
16
16
  properties = mapper.fields.each_with_object({}) do |(_name, field), acc|
17
- next unless fields_filters.all? { _1.allow?(field.name) }
17
+ next unless fields_filters.nil? || fields_filters.all? { _1.allow?(field.name) }
18
18
 
19
19
  if field.type == mapper
20
20
  acc[field.name] = {}
@@ -25,8 +25,15 @@ class ReeSwagger::BuildSerializerSchema
25
25
 
26
26
  field_mapper = field.type
27
27
 
28
- nested_fields_filters = fields_filters.map { _1.filter_for(field.name) }
29
- nested_fields_filters += [field.fields_filter]
28
+ nested_fields_filters = fields_filters&.filter_map { _1.filter_for(field.name) }
29
+
30
+ if field.fields_filter
31
+ nested_fields_filters = if nested_fields_filters
32
+ nested_fields_filters + [field.fields_filter]
33
+ else
34
+ [field.fields_filter]
35
+ end
36
+ end
30
37
 
31
38
  swagger_type = call(field_mapper, nested_fields_filters)
32
39
 
@@ -2,6 +2,7 @@ module ReeSwagger
2
2
  include Ree::PackageDSL
3
3
 
4
4
  package do
5
+ depends_on :ree_array
5
6
  depends_on :ree_mapper
6
7
  depends_on :ree_dto
7
8
  depends_on :ree_hash
@@ -47,6 +47,14 @@
47
47
  "as": "get_caster_definition",
48
48
  "imports": [
49
49
 
50
+ ]
51
+ },
52
+ {
53
+ "target": "wrap",
54
+ "package_name": "ree_array",
55
+ "as": "wrap",
56
+ "imports": [
57
+
50
58
  ]
51
59
  }
52
60
  ]
@@ -27,7 +27,7 @@
27
27
  {
28
28
  "arg": "fields_filters",
29
29
  "arg_type": "opt",
30
- "type": "ArrayOf[ReeMapper::FieldsFilter]"
30
+ "type": "Nilor[ArrayOf[ReeMapper::FieldsFilter]]"
31
31
  }
32
32
  ]
33
33
  }
@@ -22,7 +22,7 @@
22
22
  {
23
23
  "arg": "fields_filters",
24
24
  "arg_type": "opt",
25
- "type": "ArrayOf[ReeMapper::FieldsFilter]"
25
+ "type": "Nilor[ArrayOf[ReeMapper::FieldsFilter]]"
26
26
  }
27
27
  ]
28
28
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.93"
4
+ VERSION = "1.0.95"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.93
4
+ version: 1.0.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree
@@ -836,7 +836,6 @@ files:
836
836
  - lib/ree_lib/packages/ree_errors/package/ree_errors/build_error.rb
837
837
  - lib/ree_lib/packages/ree_errors/package/ree_errors/conflict_error.rb
838
838
  - lib/ree_lib/packages/ree_errors/package/ree_errors/error.rb
839
- - lib/ree_lib/packages/ree_errors/package/ree_errors/error_factory.rb
840
839
  - lib/ree_lib/packages/ree_errors/package/ree_errors/invalid_param_error.rb
841
840
  - lib/ree_lib/packages/ree_errors/package/ree_errors/not_found_error.rb
842
841
  - lib/ree_lib/packages/ree_errors/package/ree_errors/payment_required_error.rb
@@ -933,6 +932,7 @@ files:
933
932
  - lib/ree_lib/packages/ree_i18n/bin/console
934
933
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n.rb
935
934
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/add_load_path.rb
935
+ - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/check_locale_exists.rb
936
936
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/get_default_locale.rb
937
937
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/get_locale.rb
938
938
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/set_default_locale.rb
@@ -940,6 +940,7 @@ files:
940
940
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/t.rb
941
941
  - lib/ree_lib/packages/ree_i18n/package/ree_i18n/functions/with_locale.rb
942
942
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/add_load_path.schema.json
943
+ - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/check_locale_exists.schema.json
943
944
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/get_default_locale.schema.json
944
945
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/get_locale.schema.json
945
946
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/set_default_locale.schema.json
@@ -947,6 +948,7 @@ files:
947
948
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/t.schema.json
948
949
  - lib/ree_lib/packages/ree_i18n/schemas/ree_i18n/functions/with_locale.schema.json
949
950
  - lib/ree_lib/packages/ree_i18n/spec/package_schema_spec.rb
951
+ - lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/check_locale_exists.rb
950
952
  - lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/locales/en.yml
951
953
  - lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/locales/ru.yml
952
954
  - lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/set_locale_spec.rb
@@ -1,15 +0,0 @@
1
- require_relative 'error'
2
-
3
- class ReeErrors::ErrorFactory
4
- class << self
5
- contract Symbol, String => SubclassOf[ReeErrors::Error]
6
- def build(code, locale = nil)
7
- self.new.build(code, locale)
8
- end
9
- end
10
-
11
- contract Symbol, String => SubclassOf[ReeErrors::Error]
12
- def build(code, locale = nil)
13
- raise NotImplementedError, "should be implemented in derived class"
14
- end
15
- end