foobara-json-schema-generator 0.0.3 → 0.0.5

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: 3ce4af9935431fb381b2c40fdf50b84ef6163257cbc6896b9cd66db4fe61f071
4
- data.tar.gz: 02e6309f63480467b91b6fb1f1c97dc68f6fc37da8f948deeb23cdce843af5be
3
+ metadata.gz: 7dbc744ffb92537271cfafd9f469c75aa7661ab6a4c5d395d905e3d95ccd986a
4
+ data.tar.gz: 3ca5e0e634cc184e5338dea8e138c5dbc51d6e5c578de2d1b37f914053e6d0df
5
5
  SHA512:
6
- metadata.gz: 3186b0c2dbef2f5da7c1558f65ce385bc33fb30152bd2cc20a2c302279687b0c476718cbd7b53f522e79cc441cf1afa95c0f9ec1d0ab28b67ff3b5b159de797a
7
- data.tar.gz: 46cfc78e168affa876d9826f0c7de06f074abcfd013664b43c57a9d87f0fd97891f65072eee81f53e72c77d2690d6302c43fed1766955c4626512df250472362
6
+ metadata.gz: e3e44501025bc736dbf0ca36be6f599c27756f5610f878b3b48313b4ef697b93707ff8be0aaa57ba144219c05db1f0c263f396b505a626687cb0a27d322bd743
7
+ data.tar.gz: 74f1e6bd4cb4c0c359b070df0e31df22667d5447b05fd80bcd6d8d03dca7744a545e4d57d9dadc4516c30a85889fa94d6cf06abfab26eb9c3010922128bb5553
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.5] - 2025-05-25
2
+
3
+ - Support :attributes top-level type
4
+
5
+ ## [0.0.4] - 2025-04-09
6
+
7
+ - Add a .to_json_schema_structure method
8
+
1
9
  ## [0.0.3] - 2025-04-01
2
10
 
3
11
  - Fix bug not recognizing allow_nil types
@@ -4,18 +4,18 @@ module Foobara
4
4
  module JsonSchemaGenerator
5
5
  class << self
6
6
  def to_json_schema(type, association_depth: AssociationDepth::ATOM)
7
- poro = foobara_type_to_json_schema_type_poro(type, association_depth:)
7
+ poro = to_json_schema_structure(type, association_depth:)
8
8
 
9
9
  JSON.fast_generate(poro)
10
10
  end
11
11
 
12
+ def to_json_schema_structure(type, association_depth: AssociationDepth::ATOM)
13
+ foobara_type_to_json_schema_type_poro(type, association_depth:)
14
+ end
15
+
12
16
  private
13
17
 
14
- def foobara_type_to_json_schema_type_poro(
15
- type,
16
- association_depth:,
17
- within_entity: false
18
- )
18
+ def foobara_type_to_json_schema_type_poro(type, association_depth:, within_entity: false)
19
19
  declaration_data = type.declaration_data
20
20
 
21
21
  # from other place
@@ -52,7 +52,7 @@ module Foobara
52
52
  required = DataPath.value_at(:required, declaration_data)
53
53
  h = { type: "object" }
54
54
 
55
- type.element_types.each_pair do |attribute_name, element_type|
55
+ type.element_types&.each_pair do |attribute_name, element_type|
56
56
  properties[attribute_name] = foobara_type_to_json_schema_type_poro(
57
57
  element_type,
58
58
  association_depth:,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-json-schema-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-02 00:00:00.000000000 Z
10
+ date: 2025-05-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubygems_version: 3.6.6
62
+ rubygems_version: 3.6.2
63
63
  specification_version: 4
64
64
  summary: Takes a Foobara type and converts it to a json schema
65
65
  test_files: []