From 1db88ab79dee1320d942ad6e3e29dbf789658139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20=C3=98stermark?= Date: Mon, 29 Sep 2025 22:22:50 +0200 Subject: [PATCH 1/2] json schema size --- lib/dry/schema/extensions/json_schema/schema_compiler.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dry/schema/extensions/json_schema/schema_compiler.rb b/lib/dry/schema/extensions/json_schema/schema_compiler.rb index f4383693..5386bcf2 100644 --- a/lib/dry/schema/extensions/json_schema/schema_compiler.rb +++ b/lib/dry/schema/extensions/json_schema/schema_compiler.rb @@ -28,6 +28,7 @@ class SchemaCompiler time?: {type: "string", format: "time"}, min_size?: {minLength: TO_INTEGER}, max_size?: {maxLength: TO_INTEGER}, + size?: {maxLength: TO_INTEGER, minLength: TO_INTEGER}, included_in?: {enum: ->(v, _) { v.to_a }}, filled?: EMPTY_HASH, uri?: {format: "uri"}, From 2592b7a6b7e43107b92a67776367884f75dc7db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20=C3=98stermark?= Date: Tue, 21 Oct 2025 08:24:33 +0200 Subject: [PATCH 2/2] add a few more needed predicates --- lib/dry/schema/extensions/json_schema/schema_compiler.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dry/schema/extensions/json_schema/schema_compiler.rb b/lib/dry/schema/extensions/json_schema/schema_compiler.rb index 82e17da8..e5eb87d8 100644 --- a/lib/dry/schema/extensions/json_schema/schema_compiler.rb +++ b/lib/dry/schema/extensions/json_schema/schema_compiler.rb @@ -29,6 +29,13 @@ class SchemaCompiler min_size?: {minLength: TO_INTEGER}, max_size?: {maxLength: TO_INTEGER}, size?: {maxLength: TO_INTEGER, minLength: TO_INTEGER}, + format?: { + pattern: proc do |x| + x.to_s.delete_prefix("(?-mix").delete_suffix(")") + end + }, + true?: {}, + false?: {}, included_in?: {enum: ->(v, _) { v.to_a }}, filled?: EMPTY_HASH, uri?: {format: "uri"},