active_json_schema 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d5698d9ccd14c35477c6cbc937401bc7c36e96c0298a4388b708c80d59b14d6
|
4
|
+
data.tar.gz: c0abbf26c7b8d746db8def01695e8a4b3601ada6163048951eb5ebcf61c44876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad817ef2de47ccac9fd446e8418f562c5cbd6efaa16e1d19cec4d0f0242730c12b1c4db8086885d90d29e544f01f3e3b45de7cd42651107fe3e56bdfb59c5bee
|
7
|
+
data.tar.gz: '0387af4040357217eee54a97928798d9a9fc0a3f50b0fd44f3abe1bd0802d75c24843ef3cafddf61a82bf8f947287012ddd997d24cce3574b3048b785f594637'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.1.2] - 2024-10-10
|
4
|
+
|
3
5
|
### Added
|
4
6
|
- Comprehensive README with installation instructions, usage examples, and customization options
|
5
7
|
- Filled in gemspec with summary, description, and metadata
|
@@ -7,6 +9,10 @@
|
|
7
9
|
- Customizable schema generation with options for specific attributes and associations
|
8
10
|
- Ability to include nested associations in schema generation
|
9
11
|
|
12
|
+
## [0.1.1] - 2024-10-09
|
13
|
+
|
14
|
+
- No changes (version bump only)
|
15
|
+
|
10
16
|
## [0.1.0] - 2024-10-08
|
11
17
|
|
12
18
|
- Initial release
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class ConvertsToJsonSchemaWithRefs
|
4
4
|
class UnsupportedAssociationType < StandardError; end
|
5
|
+
SchemaAttributeInfo = Struct.new(:type, keyword_init: true)
|
5
6
|
|
6
7
|
def self.generate(model_class, only: nil, associations: {}, additional_properties: false)
|
7
8
|
new(model_class, only: only, associations: associations, additional_properties: additional_properties).generate
|
@@ -31,10 +32,14 @@ class ConvertsToJsonSchemaWithRefs
|
|
31
32
|
def properties_for(model_class, only, associations)
|
32
33
|
properties = {}
|
33
34
|
|
34
|
-
model_class.
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
Array(only || model_class.column_names).each do |name, type|
|
36
|
+
properties[name] = column_to_json_property(
|
37
|
+
if type
|
38
|
+
SchemaAttributeInfo.new(type: type)
|
39
|
+
else
|
40
|
+
model_class.columns_hash[name] || SchemaAttributeInfo.new(type: "string")
|
41
|
+
end
|
42
|
+
)
|
38
43
|
end
|
39
44
|
|
40
45
|
associations.each do |association_name, options|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaleb Lape
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ActiveJsonSchema extends ActiveRecord models to generate JSON Schema
|
14
14
|
representations, including support for associations.
|