jsonapi-resources-anchor 2.4.0 → 2.5.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 +4 -4
- data/lib/anchor/config.rb +3 -1
- data/lib/anchor/type_script/file_structure.rb +1 -0
- data/lib/anchor/type_script/serializer.rb +1 -1
- data/lib/anchor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9acca6a7381ed3c6095f85b22032786dd2542e81d07ff6e0ea5faeefd09de9e
|
4
|
+
data.tar.gz: 4ea4dd50bde622c0ab2da68126a892cc3f2ca6dc1282355b660b75b139b20d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027b7e5f9732f4e08d0d085cf6b5b5cb7a50a504e9d3e92932fe845255e91b5c86eaa19ef3b3bb6d5d53e42250abb762358940d6745ecaa91997fee401d8334b
|
7
|
+
data.tar.gz: a5b5116e36020f9db5e73abfdc47fd735393281aaa6a28159db9d2561b175d90386acf5602339e92907e1b460331053569dcd53d0a27f8945366cd6f8f22bfd9
|
data/lib/anchor/config.rb
CHANGED
@@ -6,7 +6,8 @@ module Anchor
|
|
6
6
|
:use_active_record_comment,
|
7
7
|
:infer_nullable_relationships_as_optional,
|
8
8
|
:empty_relationship_type,
|
9
|
-
:use_type_as_schema_name
|
9
|
+
:use_type_as_schema_name,
|
10
|
+
:maybe_as_union
|
10
11
|
|
11
12
|
def initialize
|
12
13
|
@ar_column_to_type = nil
|
@@ -16,6 +17,7 @@ module Anchor
|
|
16
17
|
@infer_nullable_relationships_as_optional = nil
|
17
18
|
@empty_relationship_type = nil
|
18
19
|
@use_type_as_schema_name = nil
|
20
|
+
@maybe_as_union = nil
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -11,7 +11,7 @@ module Anchor::TypeScript
|
|
11
11
|
when Anchor::Types::Null.singleton_class then "null"
|
12
12
|
when Anchor::Types::Record, Anchor::Types::Record.singleton_class then "Record<string, #{type_string(type.try(:value_type) || Anchor::Types::Unknown)}>"
|
13
13
|
when Anchor::Types::Union then type.types.map { |type| type_string(type, depth) }.join(" | ")
|
14
|
-
when Anchor::Types::Maybe then "Maybe<#{type_string(type.type, depth)}>"
|
14
|
+
when Anchor::Types::Maybe then Anchor.config.maybe_as_union ? type_string(Anchor::Types::Union.new([type.type, Anchor::Types::Null]), depth) : "Maybe<#{type_string(type.type, depth)}>"
|
15
15
|
when Anchor::Types::Array then "Array<#{type_string(type.type, depth)}>"
|
16
16
|
when Anchor::Types::Literal then serialize_literal(type.value)
|
17
17
|
when Anchor::Types::Reference then type.name
|
data/lib/anchor/version.rb
CHANGED
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.
|
4
|
+
version: 2.5.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-07-
|
11
|
+
date: 2025-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-resources
|