From 3ab85adc134a2b8015f76464867ba2eff148b221 Mon Sep 17 00:00:00 2001 From: David Harsha Date: Sat, 14 Oct 2023 13:23:30 -0700 Subject: [PATCH] Document custom formats This behavior has been around but undocumented for a while. I'm adding this now because it's similar to custom content encodings and media types. Related: https://github.com/davishmcclurg/json_schemer/issues/137 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 2233a21..c2729d4 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,15 @@ JSONSchemer.schema( # default: true format: true, + # custom formats + formats: { + 'int32' => proc do |instance, _format| + instance.is_a?(Integer) && instance.bit_length <= 32 + end, + # disable specific format + 'email' => false + }, + # custom content encodings # only `base64` is available by default content_encodings: {