generated_schema_validations 0.3.1 → 0.4.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: 4be368a0917bd00a79be8fc0ab6ac7ab4530bff7c3feec32fa731a5ccee2d5e3
4
- data.tar.gz: 4cb0120a7cacd178b16253d04bdab2e5aed1edc37195609bf176b510700b4824
3
+ metadata.gz: 6695669fe5683c58ba70f717c3025fff4e51baa0684842603cede227bfed0b83
4
+ data.tar.gz: 80b7ee3f1f023b56704928fc02ddd1930028449ab4162bb9ab48fd0c8ef3049b
5
5
  SHA512:
6
- metadata.gz: 542791763e87ecc0f8f54fd18e3df3d41aaf4db6c7e146f158d1d4b2d74f75f1e7d69ea6f5aa2235cdcad18fa454849cd3b93396d75d7b67e1570918713d4d48
7
- data.tar.gz: bd238fa0f5cc5953202e96893070e1c1c30b823949a11889854ccdba5765ec277192743bad6e018c8c7e287306ea9731716dd91664e9810f6f352368f78c2a59
6
+ metadata.gz: 48749688026b1328a620e9d820367e5dc2adbe294a38265aecc3e1d3755d227671b86cf104788d8dce9165d87ca0b5d9ba8a2e4387a02b0538ce830dc1ed7196
7
+ data.tar.gz: fa8fbd3809827765f766962bd928157a058ef68b41e0dc414de706d178b2b64884cf519d4069d54493dcfe851d95f33e571036cfec2f10b413b8bbaf5a455227
data/README.md CHANGED
@@ -97,6 +97,10 @@ You can watch changes on `schema_validations.rb` to understand the generated val
97
97
 
98
98
  ## Changelog
99
99
 
100
+ ### 0.4
101
+
102
+ * JSON and JSONB fields can have an empty hash and still be considered present
103
+
100
104
  ### 0.3.1
101
105
 
102
106
  * Add exclusion for enum fields
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'generated_schema_validations'
5
- spec.version = '0.3.1'
5
+ spec.version = '0.4.0'
6
6
  spec.authors = ['Georg Limbach']
7
7
  spec.email = ['georg.limbach@lichtbit.com']
8
8
 
@@ -55,6 +55,8 @@ class GeneratedSchemaValidations::Table
55
55
  @possible_belongs_to_not_null_columns.push(name.to_sym) if datatype.in?(%i[bigint integer uuid])
56
56
  if datatype == :boolean
57
57
  validates name, :inclusion, in: [true, false], message: :blank
58
+ elsif datatype.in?(%i[json jsonb])
59
+ validates name, :exclusion, in: [nil], message: :blank
58
60
  else
59
61
  validates name, :presence
60
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generated_schema_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Limbach
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2025-10-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: After each migration it generates a file with some validations. Each
14
14
  active record should include this file and can uns generated validations.
@@ -38,7 +38,7 @@ licenses:
38
38
  metadata:
39
39
  homepage_uri: https://github.com/Lichtbit/generated_schema_validations
40
40
  source_code_uri: https://github.com/Lichtbit/generated_schema_validations
41
- post_install_message:
41
+ post_install_message:
42
42
  rdoc_options: []
43
43
  require_paths:
44
44
  - lib
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  version: '0'
55
55
  requirements: []
56
56
  rubygems_version: 3.3.26
57
- signing_key:
57
+ signing_key:
58
58
  specification_version: 4
59
59
  summary: Generate rails validations from schema.rb file
60
60
  test_files: []