Skip to content

Commit

Permalink
Document custom formats
Browse files Browse the repository at this point in the history
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: #137
  • Loading branch information
davishmcclurg committed Oct 24, 2023
1 parent febaf26 commit 3ab85ad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 3ab85ad

Please sign in to comment.