@@ -6,17 +6,34 @@ order: 6
66
77# Validation
88
9+ ## Foreword
10+
11+ <p class =" message-warning " >
12+ While this package parses and serializes HTTP field value, it does not validate its content
13+ against any conformance rule out of the box. You are still required to perform such a
14+ compliance check against the constraints of the corresponding field. While Content
15+ validation is still possible and highly encouraged when using this library. Because
16+ of the wide variety of HTTP fields it can not be made mandatory.
17+ </p >
18+
19+ ## Validating a field
20+ `
921When it comes to make sure about the incoming data the package provides a simple approach around validation,
1022To learn and understand the package validation mechanism we will look at a real world example and expand on it.
1123
1224So what we are going to do is validating the following putative HTTP field ` temperature ` .
1325
14- > The field is defined as a List. meaning it can contain multiple temperature
15- > definitions as items. Each temperature entry MUST contain a temperature value express in Celsius.
16- > The temperature has the following required parameters ` date ` , ` longitude ` and ` latitude `
17- > and an optional ` location ` parameter which is a human-readable name of the location where
18- > the temperature was read. The ` location ` can be a ` string ` or a ` displaystring ` . The latitude
19- > and longitude are express as ` decimal ` values. You will find below an example of such HTTP field.
26+ <dl >
27+ <dt ><dfn >temperature</dfn ></dt >
28+ <dt >
29+ The field is defined as a List. meaning it can contain multiple temperature
30+ definitions as items. Each temperature entry MUST contain a temperature value express in Celsius.
31+ The temperature has the following required parameters ` date ` , ` longitude ` and ` latitude `
32+ and an optional ` location ` parameter which is a human-readable name of the location where
33+ the temperature was read. The ` location ` can be a ` string ` or a ` displaystring ` . The latitude
34+ and longitude are express as ` decimal ` values. You will find below an example of such HTTP field.
35+ </dt >
36+ </dl >
2037
2138``` bash
2239temperature: 18.3; location=%" lagos" ; date=@1731573026; longitude=6.418; latitude=3.389, 12.8; date=@1730894400; longitude=6.418; latitude=3.389
0 commit comments