foobara-json-schema-generator 0.0.2 → 0.0.4

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: a5d6de3550361f7b414e8fb442e8988763e9f0312b4210cfe80b31b6aeb74b55
4
- data.tar.gz: 78fa82454f7355f2c671d887ca752828a2d88e489c19c30c10c466d7ca3e7f58
3
+ metadata.gz: a94699fe3e7b694ed21e4b2b900c50c11a83c6f282da6c9e20ca82e1d8b24bb0
4
+ data.tar.gz: e302c63539be3fc1442b244a27ec24e8ec827b1553a8c4c8e93ee334da603bb5
5
5
  SHA512:
6
- metadata.gz: '09bb9a01c5a6e260542e2f80d82ec74d2349efc6347de4b18cd5657de86420bc4c1026f7e55c8ddf3a10e7d13ab9555ab187fb8c5ae3f99640ab7fb6db863b24'
7
- data.tar.gz: a24ba3c568b0b95c2a5c5ae346446ce570a86c6ae91a949c0683e419c5fd0199b08acb1d41df4e851e0db220944aa1c85630bf09db44251b95954b049fefa411
6
+ metadata.gz: 906e85635efb11f9e8d9eadf628bab64b891c98c83a45eaa49806bb0d6f4a7d9e171e8777d3d41fc1ac7a41fbd6cf2b2760399aa1d07fd178b380cad4bc1b0e5
7
+ data.tar.gz: 14efb7cb822c98bc67267f5c33c81db2c54a16764e0420fc6a93946b67c624ce0af5cfd71e5a7ee1a72655fe66c28994f3a8b54b36ee1fec215c17765a330b1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.4] - 2025-04-09
2
+
3
+ - Add a .to_json_schema_structure method
4
+
5
+ ## [0.0.3] - 2025-04-01
6
+
7
+ - Fix bug not recognizing allow_nil types
8
+
1
9
  ## [0.0.2] - 2025-03-04
2
10
 
3
11
  - Include descriptions in generated json schema
@@ -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
@@ -101,9 +101,9 @@ module Foobara
101
101
  type_hash[:enum] = one_of
102
102
  end
103
103
 
104
- allows_nil = DataPath.value_at(:allow_nil, declaration_data)
104
+ allow_nil = DataPath.value_at(:allow_nil, declaration_data)
105
105
 
106
- if allows_nil && type_hash.key?(:type)
106
+ if allow_nil && type_hash.key?(:type)
107
107
  type_hash[:type] = [type_hash[:type], "null"]
108
108
  end
109
109
 
metadata CHANGED
@@ -1,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-json-schema-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-04 00:00:00.000000000 Z
10
+ date: 2025-04-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: 0.0.92
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: 0.0.92
26
26
  email:
27
27
  - azimux@gmail.com
28
28
  executables: []
@@ -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.3
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: []