1JSON::Validator::FormatUss(e3r)Contributed Perl DocumentJaStOiNo:n:Validator::Formats(3)
2
3
4

NAME

6       JSON::Validator::Formats - Functions for valiating JSON schema formats
7

SYNOPSIS

9         use JSON::Validator::Formats;
10         my $error = JSON::Validator::Formats::check_uri($str);
11         die $error if $error;
12
13         my $jv = JSON::Validator->new;
14         $jv->formats({
15           "date-time"     => JSON::Validator::Formats->can("check_date_time"),
16           "email"         => JSON::Validator::Formats->can("check_email"),
17           "hostname"      => JSON::Validator::Formats->can("check_hostname"),
18           "ipv4"          => JSON::Validator::Formats->can("check_ipv4"),
19           "ipv6"          => JSON::Validator::Formats->can("check_ipv6"),
20           "regex"         => JSON::Validator::Formats->can("check_regex"),
21           "uri"           => JSON::Validator::Formats->can("check_uri"),
22           "uri-reference" => JSON::Validator::Formats->can("check_uri_reference"),
23         });
24

DESCRIPTION

26       JSON::Validator::Formats is a module with utility functions used by
27       "formats" in JSON::Validator to match JSON Schema formats.
28

FUNCTIONS

30   check_date
31         my $str_or_undef = check_date $str;
32
33       Validates the date part of a RFC3339 string.
34
35   check_date_time
36         my $str_or_undef = check_date_time $str;
37
38       Validated against RFC3339 timestamp in UTC time. This is formatted as
39       "YYYY-MM-DDThh:mm:ss.fffZ". The milliseconds portion (".fff") is
40       optional
41
42   check_email
43         my $str_or_undef = check_email $str;
44
45       Validated against the RFC5322 spec.
46
47   check_hostname
48         my $str_or_undef = check_hostname $str;
49
50       Will be validated using "is_hostname" in Data::Validate::Domain, if
51       installed.
52
53   check_idn_email
54         my $str_or_undef = check_idn_email $str;
55
56       Will validate an email with non-ASCII characters using Net::IDN::Encode
57       if installed.
58
59   check_idn_hostname
60         my $str_or_undef = check_idn_hostname $str;
61
62       Will validate a hostname with non-ASCII characters using
63       Net::IDN::Encode if installed.
64
65   check_ipv4
66         my $str_or_undef = check_ipv4 $str;
67
68       Will be validated using "is_ipv4" in Data::Validate::IP, if installed
69       or fall back to a plain IPv4 IP regex.
70
71   check_ipv6
72         my $str_or_undef = check_ipv6 $str;
73
74       Will be validated using "is_ipv6" in Data::Validate::IP, if installed.
75
76   check_iri
77         my $str_or_undef = check_iri $str;
78
79       Validate either an absolute IRI containing ASCII or non-ASCII
80       characters, against the RFC3986 spec.
81
82   check_iri_reference
83         my $str_or_undef = check_iri_reference $str;
84
85       Validate either a relative or absolute IRI containing ASCII or non-
86       ASCII characters, against the RFC3986 spec.
87
88   check_json_pointer
89         my $str_or_undef = check_json_pointer $str;
90
91       Validates a JSON pointer, such as "/foo/bar/42".
92
93   check_regex
94         my $str_or_undef = check_regex $str;
95
96       Will check if the string is a regex, using "qr{...}".
97
98   check_relative_json_pointer
99         my $str_or_undef = check_relative_json_pointer $str;
100
101       Validates a relative JSON pointer, such as "0/foo" or "3#".
102
103   check_time
104         my $str_or_undef = check_time $str;
105
106       Validates the time and optionally the offset part of a RFC3339 string.
107
108   check_uri
109         my $str_or_undef = check_uri $str;
110
111       Validate either a relative or absolute URI containing just ASCII
112       characters, against the RFC3986 spec.
113
114       Note that this might change in the future to only check absolute URI.
115
116   check_uri_reference
117         my $str_or_undef = check_uri_reference $str;
118
119       Validate either a relative or absolute URI containing just ASCII
120       characters, against the RFC3986 spec.
121
122   check_uri_template
123         my $str_or_undef = check_uri_reference $str;
124
125       Validate an absolute URI with template characters.
126

SEE ALSO

128       JSON::Validator.
129
130
131
132perl v5.28.1                      2019-01-21       JSON::Validator::Formats(3)
Impressum