jsonapi-resources-anchor 2.9.2 → 2.10.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: b6b495cccd59d5fe578f078f41827035d72da3829e8141963c3b475eb5f526da
4
- data.tar.gz: ff128bb2b40e9410d07750c3d420e9b6ccdea4b4a959aa1fea30b3e2b94a243c
3
+ metadata.gz: 2be1c5d189bf0a9d8200ccced6601f789ba0bffd276ab0cd601c5d8ce97f543b
4
+ data.tar.gz: 1e1c9cf6a077c2ab0b99c82b01fdfe3e4577efc6a7dfc17d08f63f219709af1c
5
5
  SHA512:
6
- metadata.gz: ea29aace3714798eb05322f62fe18b712a1331ba0771636577f3505cdd4220df7ec757dcaabc232eb2e4a7ce8c4f9a6605be27452d23ebcb44fdfea605f0a2a5
7
- data.tar.gz: fd5235b86ebbf0f310f0fc4da805337e6e60c5e1c8be988fd1ac22faa8bdcb7ac37f4674f04ed81918142b684468eae2b0d7c23d1c7ec4bb39732eb476758c36
6
+ metadata.gz: d9d62874eed56bcbe86398619b6a3fd6461e5c2976ca6f9eb9324d55eddf94d8c7bd7a171d07a498d23b79e83d4aa71cc155ff9de141aca46700b95a2af6f0e4
7
+ data.tar.gz: 59f4f043742ef21b8240b5984d408c0ad829b20bdd56d7c44eac12f987515d11024360245a98b4a092bf6dec9d8f0e70757ac08a06084de8eddb90ac4b52b5d7
data/lib/anchor/config.rb CHANGED
@@ -9,7 +9,8 @@ module Anchor
9
9
  :use_type_as_schema_name,
10
10
  :maybe_as_union,
11
11
  :array_bracket_notation,
12
- :infer_default_as_non_null
12
+ :infer_default_as_non_null,
13
+ :ar_comment_to_string
13
14
 
14
15
  def initialize
15
16
  @ar_column_to_type = nil
@@ -22,6 +23,7 @@ module Anchor
22
23
  @maybe_as_union = nil
23
24
  @array_bracket_notation = nil
24
25
  @infer_default_as_non_null = nil
26
+ @ar_comment_to_string = nil
25
27
  end
26
28
  end
27
29
  end
@@ -79,7 +79,12 @@ module Anchor
79
79
  column = !method_defined && _model_class.try(:columns_hash).try(:[], model_method.to_s)
80
80
  if column
81
81
  type = Anchor::Types::Inference::ActiveRecord::SQL.from(column)
82
- description ||= column.comment if Anchor.config.use_active_record_comment
82
+ unless description
83
+ description = column.comment if Anchor.config.use_active_record_comment
84
+ if description && !Anchor.config.ar_comment_to_string.nil?
85
+ description = Anchor.config.ar_comment_to_string.call(description)
86
+ end
87
+ end
83
88
  check_presence = type.is_a?(Anchor::Types::Maybe) && Anchor.config.use_active_record_validations
84
89
  if check_presence && _model_class.validators_on(model_method).any? do |v|
85
90
  if v.is_a?(ActiveRecord::Validations::NumericalityValidator)
@@ -1,3 +1,3 @@
1
1
  module Anchor
2
- VERSION = "2.9.2"
2
+ VERSION = "2.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources-anchor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-27 00:00:00.000000000 Z
11
+ date: 2025-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-resources