@@ -1,7 +1,10 @@
11
22module Data.JsonSchema.Draft4.Schema where
33
4−import qualified Data.HashMap.Strict as H
4+import Import
5+import Prelude
6+
7+import qualified Data.HashMap.Strict as HM
58import Data.List.NonEmpty (NonEmpty)
69import Data.Maybe (fromJust, isJust)
710import Data.Scientific
@@ -10,325 +13,326 @@ import qualified Data.Validator.Draft4.Any as AN
1013import qualified Data.Validator.Draft4.Array as AR
1114import qualified Data.Validator.Draft4.Object as OB
1215import Data.Validator.Utils
13−import Import
1416
1517data Schema = Schema
16− { _schemaVersion :: Maybe Text
17− , _schemaId :: Maybe Text
18− , _schemaRef :: Maybe Text
19− , _schemaDefinitions :: Maybe (HashMap Text Schema)
20− -- ^ A standardized location for embedding schemas
21− -- to be referenced from elsewhere in the document.
22− , _schemaOther :: HashMap Text Value
23− -- ^ Since the JSON document this Schema was built from could
24− -- contain schemas anywhere (not just in "definitions" or any
25− -- of the other official keys) we save any leftover key/value
26− -- pairs not covered by them here.
27−
28− , _schemaMultipleOf :: Maybe Scientific
29− , _schemaMaximum :: Maybe Scientific
30− , _schemaExclusiveMaximum :: Maybe Bool
31− , _schemaMinimum :: Maybe Scientific
32− , _schemaExclusiveMinimum :: Maybe Bool
33−
34− , _schemaMaxLength :: Maybe Int
35− , _schemaMinLength :: Maybe Int
36− , _schemaPattern :: Maybe Text
37−
38− , _schemaMaxItems :: Maybe Int
39− , _schemaMinItems :: Maybe Int
40− , _schemaUniqueItems :: Maybe Bool
41− , _schemaItems :: Maybe (AR.Items Schema)
42− -- Note that '_schemaAdditionalItems' is left out of 'runValidate'
43− -- because its functionality is handled by '_schemaItems'. It always
44− -- validates data unless 'Items' is present.
45− , _schemaAdditionalItems :: Maybe (AR.AdditionalItems Schema)
46−
47− , _schemaMaxProperties :: Maybe Int
48− , _schemaMinProperties :: Maybe Int
49− , _schemaRequired :: Maybe OB.Required
50− , _schemaDependencies :: Maybe (HashMap Text (OB.Dependency Schema))
51− , _schemaProperties :: Maybe (HashMap Text Schema)
52− , _schemaPatternProperties :: Maybe (HashMap Text Schema)
53− , _schemaAdditionalProperties :: Maybe (OB.AdditionalProperties Schema)
54−
55− , _schemaEnum :: Maybe AN.EnumVal
56− , _schemaType :: Maybe AN.TypeVal
57− , _schemaAllOf :: Maybe (NonEmpty Schema)
58− , _schemaAnyOf :: Maybe (NonEmpty Schema)
59− , _schemaOneOf :: Maybe (NonEmpty Schema)
60− , _schemaNot :: Maybe Schema
61− } deriving (Eq, Show)
18+ { _schemaVersion :: Maybe Text
19+ , _schemaId :: Maybe Text
20+ , _schemaRef :: Maybe Text
21+ , _schemaDefinitions :: Maybe (HashMap Text Schema)
22+ -- ^ A standardized location for embedding schemas
23+ -- to be referenced from elsewhere in the document.
24+ , _schemaOther :: HashMap Text Value
25+ -- ^ Since the JSON document this schema was built from could
26+ -- contain schemas anywhere (not just in "definitions" or any
27+ -- of the other official keys) we save any leftover key/value
28+ -- pairs not covered by them here.
29+
30+ , _schemaMultipleOf :: Maybe Scientific
31+ , _schemaMaximum :: Maybe Scientific
32+ , _schemaExclusiveMaximum :: Maybe Bool
33+ , _schemaMinimum :: Maybe Scientific
34+ , _schemaExclusiveMinimum :: Maybe Bool
35+
36+ , _schemaMaxLength :: Maybe Int
37+ , _schemaMinLength :: Maybe Int
38+ , _schemaPattern :: Maybe Text
39+
40+ , _schemaMaxItems :: Maybe Int
41+ , _schemaMinItems :: Maybe Int
42+ , _schemaUniqueItems :: Maybe Bool
43+ , _schemaItems :: Maybe (AR.Items Schema)
44+ -- Note that '_schemaAdditionalItems' is left out of 'runValidate'
45+ -- because its functionality is handled by '_schemaItems'. It always
46+ -- validates data unless 'Items' is present.
47+ , _schemaAdditionalItems :: Maybe (AR.AdditionalItems Schema)
48+
49+ , _schemaMaxProperties :: Maybe Int
50+ , _schemaMinProperties :: Maybe Int
51+ , _schemaRequired :: Maybe OB.Required
52+ , _schemaDependencies :: Maybe (HashMap Text (OB.Dependency Schema))
53+ , _schemaProperties :: Maybe (HashMap Text Schema)
54+ , _schemaPatternProperties :: Maybe (HashMap Text Schema)
55+ , _schemaAdditionalProperties :: Maybe (OB.AdditionalProperties Schema)
56+
57+ , _schemaEnum :: Maybe AN.EnumVal
58+ , _schemaType :: Maybe AN.TypeVal
59+ , _schemaAllOf :: Maybe (NonEmpty Schema)
60+ , _schemaAnyOf :: Maybe (NonEmpty Schema)
61+ , _schemaOneOf :: Maybe (NonEmpty Schema)
62+ , _schemaNot :: Maybe Schema
63+ } deriving (Eq, Show)
6264
6365emptySchema :: Schema
6466emptySchema = Schema
65− { _schemaVersion = Nothing
66− , _schemaId = Nothing
67− , _schemaRef = Nothing
68− , _schemaDefinitions = Nothing
69− , _schemaOther = mempty
70−
71− , _schemaMultipleOf = Nothing
72− , _schemaMaximum = Nothing
73− , _schemaExclusiveMaximum = Nothing
74− , _schemaMinimum = Nothing
75− , _schemaExclusiveMinimum = Nothing
76−
77− , _schemaMaxLength = Nothing
78− , _schemaMinLength = Nothing
79− , _schemaPattern = Nothing
80−
81− , _schemaMaxItems = Nothing
82− , _schemaMinItems = Nothing
83− , _schemaUniqueItems = Nothing
84− , _schemaItems = Nothing
85− , _schemaAdditionalItems = Nothing
86−
87− , _schemaMaxProperties = Nothing
88− , _schemaMinProperties = Nothing
89− , _schemaRequired = Nothing
90− , _schemaDependencies = Nothing
91− , _schemaProperties = Nothing
92− , _schemaPatternProperties = Nothing
93− , _schemaAdditionalProperties = Nothing
94−
95− , _schemaEnum = Nothing
96− , _schemaType = Nothing
97− , _schemaAllOf = Nothing
98− , _schemaAnyOf = Nothing
99− , _schemaOneOf = Nothing
100− , _schemaNot = Nothing
101− }
67+ { _schemaVersion = Nothing
68+ , _schemaId = Nothing
69+ , _schemaRef = Nothing
70+ , _schemaDefinitions = Nothing
71+ , _schemaOther = mempty
72+
73+ , _schemaMultipleOf = Nothing
74+ , _schemaMaximum = Nothing
75+ , _schemaExclusiveMaximum = Nothing
76+ , _schemaMinimum = Nothing
77+ , _schemaExclusiveMinimum = Nothing
78+
79+ , _schemaMaxLength = Nothing
80+ , _schemaMinLength = Nothing
81+ , _schemaPattern = Nothing
82+
83+ , _schemaMaxItems = Nothing
84+ , _schemaMinItems = Nothing
85+ , _schemaUniqueItems = Nothing
86+ , _schemaItems = Nothing
87+ , _schemaAdditionalItems = Nothing
88+
89+ , _schemaMaxProperties = Nothing
90+ , _schemaMinProperties = Nothing
91+ , _schemaRequired = Nothing
92+ , _schemaDependencies = Nothing
93+ , _schemaProperties = Nothing
94+ , _schemaPatternProperties = Nothing
95+ , _schemaAdditionalProperties = Nothing
96+
97+ , _schemaEnum = Nothing
98+ , _schemaType = Nothing
99+ , _schemaAllOf = Nothing
100+ , _schemaAnyOf = Nothing
101+ , _schemaOneOf = Nothing
102+ , _schemaNot = Nothing
103+ }
102104
103105instance FromJSON Schema where
104− parseJSON = withObject "Schema" $ \o -> do
105− a <- o .:? "$schema"
106− b <- o .:? "id"
107− c <- o .:? "$ref"
108− d <- o .:? "definitions"
109− e <- parseJSON (Object (H.difference o internalSchemaHashMap))
110−
111− f <- o .:? "multipleOf"
112− g <- o .:? "maximum"
113− h <- o .:? "exclusiveMaximum"
114− i <- o .:? "minimum"
115− j <- o .:? "exclusiveMinimum"
116−
117− k <- o .:? "maxLength"
118− l <- o .:? "minLength"
119− m <- o .:? "pattern"
120−
121− n <- o .:? "maxItems"
122− o' <- o .:? "minItems"
123− p <- o .:? "uniqueItems"
124− q <- o .:? "items"
125− r <- o .:? "additionalItems"
126−
127− s <- o .:? "maxProperties"
128− t <- o .:? "minProperties"
129− u <- o .:? "required"
130− v <- o .:? "dependencies"
131− w <- o .:? "properties"
132− x <- o .:? "patternProperties"
133− y <- o .:? "additionalProperties"
134−
135− z <- o .:? "enum"
136− a2 <- o .:? "type"
137− b2 <- fmap _unNonEmpty' <$> o .:? "allOf"
138− c2 <- fmap _unNonEmpty' <$> o .:? "anyOf"
139− d2 <- fmap _unNonEmpty' <$> o .:? "oneOf"
140− e2 <- o .:? "not"
141− pure Schema
142− { _schemaVersion = a
143− , _schemaId = b
144− , _schemaRef = c
145− , _schemaDefinitions = d
146− , _schemaOther = e
147−
148− , _schemaMultipleOf = f
149− , _schemaMaximum = g
150− , _schemaExclusiveMaximum = h
151− , _schemaMinimum = i
152− , _schemaExclusiveMinimum = j
153−
154− , _schemaMaxLength = k
155− , _schemaMinLength = l
156− , _schemaPattern = m
157−
158− , _schemaMaxItems = n
159− , _schemaMinItems = o'
160− , _schemaUniqueItems = p
161− , _schemaItems = q
162− , _schemaAdditionalItems = r
163−
164− , _schemaMaxProperties = s
165− , _schemaMinProperties = t
166− , _schemaRequired = u
167− , _schemaDependencies = v
168− , _schemaProperties = w
169− , _schemaPatternProperties = x
170− , _schemaAdditionalProperties = y
171−
172− , _schemaEnum = z
173− , _schemaType = a2
174− , _schemaAllOf = b2
175− , _schemaAnyOf = c2
176− , _schemaOneOf = d2
177− , _schemaNot = e2
178− }
106+ parseJSON = withObject "Schema" $ \o -> do
107+ a <- o .:! "$schema"
108+ b <- o .:! "id"
109+ c <- o .:! "$ref"
110+ d <- o .:! "definitions"
111+ e <- parseJSON (Object (HM.difference o internalSchemaHashMap))
112+
113+ f <- o .:! "multipleOf"
114+ g <- o .:! "maximum"
115+ h <- o .:! "exclusiveMaximum"
116+ i <- o .:! "minimum"
117+ j <- o .:! "exclusiveMinimum"
118+
119+ k <- o .:! "maxLength"
120+ l <- o .:! "minLength"
121+ m <- o .:! "pattern"
122+
123+ n <- o .:! "maxItems"
124+ o' <- o .:! "minItems"
125+ p <- o .:! "uniqueItems"
126+ q <- o .:! "items"
127+ r <- o .:! "additionalItems"
128+
129+ s <- o .:! "maxProperties"
130+ t <- o .:! "minProperties"
131+ u <- o .:! "required"
132+ v <- o .:! "dependencies"
133+ w <- o .:! "properties"
134+ x <- o .:! "patternProperties"
135+ y <- o .:! "additionalProperties"
136+
137+ z <- o .:! "enum"
138+ a2 <- o .:! "type"
139+ b2 <- fmap _unNonEmpty' <$> o .:! "allOf"
140+ c2 <- fmap _unNonEmpty' <$> o .:! "anyOf"
141+ d2 <- fmap _unNonEmpty' <$> o .:! "oneOf"
142+ e2 <- o .:! "not"
143+ pure Schema
144+ { _schemaVersion = a
145+ , _schemaId = b
146+ , _schemaRef = c
147+ , _schemaDefinitions = d
148+ , _schemaOther = e
149+
150+ , _schemaMultipleOf = f
151+ , _schemaMaximum = g
152+ , _schemaExclusiveMaximum = h
153+ , _schemaMinimum = i
154+ , _schemaExclusiveMinimum = j
155+
156+ , _schemaMaxLength = k
157+ , _schemaMinLength = l
158+ , _schemaPattern = m
159+
160+ , _schemaMaxItems = n
161+ , _schemaMinItems = o'
162+ , _schemaUniqueItems = p
163+ , _schemaItems = q
164+ , _schemaAdditionalItems = r
165+
166+ , _schemaMaxProperties = s
167+ , _schemaMinProperties = t
168+ , _schemaRequired = u
169+ , _schemaDependencies = v
170+ , _schemaProperties = w
171+ , _schemaPatternProperties = x
172+ , _schemaAdditionalProperties = y
173+
174+ , _schemaEnum = z
175+ , _schemaType = a2
176+ , _schemaAllOf = b2
177+ , _schemaAnyOf = c2
178+ , _schemaOneOf = d2
179+ , _schemaNot = e2
180+ }
179181
180182instance ToJSON Schema where
181− -- | The way we resolve JSON Pointers to embedded schemas is by
182− -- serializing the containing schema to a value and then resolving the
183− -- pointer against it. This means that FromJSON and ToJSON must be
184− -- isomorphic.
185− --
186− -- This influences the design choices in the library. E.g. right now
187− -- there are two false values for "exclusiveMaximum" -- Nothing and
188− -- Just False. We could have condensed them down by using () instead
189− -- of Bool for "exclusiveMaximum". This would have made writing schemas
190− -- in haskell easier, but we could no longer round trip through/from
191− -- JSON without losing information.
192− toJSON s = Object $ H.union (mapMaybe ($ s) internalSchemaHashMap) (toJSON <$> _schemaOther s)
193− where
194− -- 'mapMaybe' is provided by unordered-containers after unordered-container-2.6.0.0,
195− -- but until that is a little older (and has time to get into Stackage etc.)
196− -- we use our own implementation.
197− mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2
198− mapMaybe f = fmap fromJust . H.filter isJust . fmap f
183+ -- | The way we resolve JSON Pointers to embedded schemas is by
184+ -- serializing the containing schema to a value and then resolving the
185+ -- pointer against it. This means that FromJSON and ToJSON must be
186+ -- isomorphic.
187+ --
188+ -- This influences the design choices in the library. E.g. right now
189+ -- there are two false values for "exclusiveMaximum" -- Nothing and
190+ -- Just False. We could have condensed them down by using () instead
191+ -- of Bool for "exclusiveMaximum". This would have made writing schemas
192+ -- in haskell easier, but we could no longer round trip through/from
193+ -- JSON without losing information.
194+ toJSON s = Object $ HM.union (mapMaybe ($ s) internalSchemaHashMap)
195+ (toJSON <$> _schemaOther s)
196+ where
197+ -- 'mapMaybe' is provided by unordered-containers after
198+ -- unordered-container-2.6.0.0, but until that is a little older
199+ -- (and has time to get into Stackage etc.) we use our own
200+ -- implementation.
201+ mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2
202+ mapMaybe f = fmap fromJust . HM.filter isJust . fmap f
199203
200204-- | Internal. Separate from ToJSON because it's also used
201205-- by FromJSON to determine what keys aren't official schema
202206-- keys and therefor should be included in _schemaOther.
203207internalSchemaHashMap :: HashMap Text (Schema -> Maybe Value)
204−internalSchemaHashMap = H.fromList
205− [ ("$schema" , f _schemaVersion)
206− , ("id" , f _schemaId)
207− , ("$ref" , f _schemaRef)
208− , ("definitions" , f _schemaDefinitions)
209−
210− , ("multipleOf" , f _schemaMultipleOf)
211− , ("maximum" , f _schemaMaximum)
212− , ("exclusiveMaximum" , f _schemaExclusiveMaximum)
213− , ("minimum" , f _schemaMinimum)
214− , ("exclusiveMinimum" , f _schemaExclusiveMinimum)
215−
216− , ("maxLength" , f _schemaMaxLength)
217− , ("minLength" , f _schemaMinLength)
218− , ("pattern" , f _schemaPattern)
219−
220− , ("maxItems" , f _schemaMaxItems)
221− , ("minItems" , f _schemaMinItems)
222− , ("uniqueItems" , f _schemaUniqueItems)
223− , ("items" , f _schemaItems)
224− , ("additionalItems" , f _schemaAdditionalItems)
225−
226− , ("maxProperties" , f _schemaMaxProperties)
227− , ("minProperties" , f _schemaMinProperties)
228− , ("required" , f _schemaRequired)
229− , ("dependencies" , f _schemaDependencies)
230− , ("properties" , f _schemaProperties)
231− , ("patternProperties" , f _schemaPatternProperties)
232− , ("additionalProperties", f _schemaAdditionalProperties)
233−
234− , ("enum" , f _schemaEnum)
235− , ("type" , f _schemaType)
236− , ("allOf" , f (fmap NonEmpty' . _schemaAllOf))
237− , ("anyOf" , f (fmap NonEmpty' . _schemaAnyOf))
238− , ("oneOf" , f (fmap NonEmpty' . _schemaOneOf))
239− , ("not" , f _schemaNot)
240− ]
208+internalSchemaHashMap = HM.fromList
209+ [ ("$schema" , f _schemaVersion)
210+ , ("id" , f _schemaId)
211+ , ("$ref" , f _schemaRef)
212+ , ("definitions" , f _schemaDefinitions)
213+
214+ , ("multipleOf" , f _schemaMultipleOf)
215+ , ("maximum" , f _schemaMaximum)
216+ , ("exclusiveMaximum" , f _schemaExclusiveMaximum)
217+ , ("minimum" , f _schemaMinimum)
218+ , ("exclusiveMinimum" , f _schemaExclusiveMinimum)
219+
220+ , ("maxLength" , f _schemaMaxLength)
221+ , ("minLength" , f _schemaMinLength)
222+ , ("pattern" , f _schemaPattern)
223+
224+ , ("maxItems" , f _schemaMaxItems)
225+ , ("minItems" , f _schemaMinItems)
226+ , ("uniqueItems" , f _schemaUniqueItems)
227+ , ("items" , f _schemaItems)
228+ , ("additionalItems" , f _schemaAdditionalItems)
229+
230+ , ("maxProperties" , f _schemaMaxProperties)
231+ , ("minProperties" , f _schemaMinProperties)
232+ , ("required" , f _schemaRequired)
233+ , ("dependencies" , f _schemaDependencies)
234+ , ("properties" , f _schemaProperties)
235+ , ("patternProperties" , f _schemaPatternProperties)
236+ , ("additionalProperties", f _schemaAdditionalProperties)
237+
238+ , ("enum" , f _schemaEnum)
239+ , ("type" , f _schemaType)
240+ , ("allOf" , f (fmap NonEmpty' . _schemaAllOf))
241+ , ("anyOf" , f (fmap NonEmpty' . _schemaAnyOf))
242+ , ("oneOf" , f (fmap NonEmpty' . _schemaOneOf))
243+ , ("not" , f _schemaNot)
244+ ]
241245 where
242246 f :: ToJSON a => (Schema -> Maybe a) -> Schema -> Maybe Value
243247 f = (fmap.fmap) toJSON
244248
245249instance Arbitrary Schema where
246− arbitrary = sized f
247− where
248− maybeGen :: Gen a -> Gen (Maybe a)
249− maybeGen a = oneof [pure Nothing, Just <$> a]
250−
251− maybeRecurse :: Int -> Gen a -> Gen (Maybe a)
252− maybeRecurse n a
253− | n < 1 = pure Nothing
254− | otherwise = maybeGen $ resize (n `div` 10) a
255−
256− f :: Int -> Gen Schema
257− f n = do
258− a <- maybeGen arbitraryText
259− b <- maybeGen arbitraryText
260− c <- maybeGen arbitraryText
261− -- NOTE: The next two fields are empty to generate cleaner schemas,
262− -- but note that this means we don't test e.g. the invertability
263− -- of these fields.
264− d <- pure Nothing -- _schemaDefinitions
265− e <- pure mempty -- _otherPairs
266−
267− f' <- maybeGen arbitraryPositiveScientific
268− g <- maybeGen arbitraryScientific
269− h <- arbitrary
270− i <- maybeGen arbitraryScientific
271− j <- arbitrary
272−
273− k <- maybeGen (getPositive <$> arbitrary)
274− l <- maybeGen (getPositive <$> arbitrary)
275− m <- maybeGen arbitraryText
276−
277− n' <- maybeGen (getPositive <$> arbitrary)
278− o <- maybeGen (getPositive <$> arbitrary)
279− p <- arbitrary
280− q <- maybeRecurse n arbitrary
281− r <- maybeRecurse n arbitrary
282−
283− s <- maybeGen (getPositive <$> arbitrary)
284− t <- maybeGen (getPositive <$> arbitrary)
285− u <- arbitrary
286− v <- maybeRecurse n arbitraryHashMap
287− w <- maybeRecurse n arbitraryHashMap
288− x <- maybeRecurse n arbitraryHashMap
289− y <- maybeRecurse n arbitrary
290−
291− z <- arbitrary
292− a2 <- arbitrary
293− b2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
294− c2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
295− d2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
296− e2 <- maybeRecurse n arbitrary
297− pure Schema
298− { _schemaVersion = a
299− , _schemaId = b
300− , _schemaRef = c
301− , _schemaDefinitions = d
302− , _schemaOther = e
303−
304− , _schemaMultipleOf = f'
305− , _schemaMaximum = g
306− , _schemaExclusiveMaximum = h
307− , _schemaMinimum = i
308− , _schemaExclusiveMinimum = j
309−
310− , _schemaMaxLength = k
311− , _schemaMinLength = l
312− , _schemaPattern = m
313−
314− , _schemaMaxItems = n'
315− , _schemaMinItems = o
316− , _schemaUniqueItems = p
317− , _schemaItems = q
318− , _schemaAdditionalItems = r
319−
320− , _schemaMaxProperties = s
321− , _schemaMinProperties = t
322− , _schemaRequired = u
323− , _schemaDependencies = v
324− , _schemaProperties = w
325− , _schemaPatternProperties = x
326− , _schemaAdditionalProperties = y
327−
328− , _schemaEnum = z
329− , _schemaType = a2
330− , _schemaAllOf = b2
331− , _schemaAnyOf = c2
332− , _schemaOneOf = d2
333− , _schemaNot = e2
334− }
250+ arbitrary = sized f
251+ where
252+ maybeGen :: Gen a -> Gen (Maybe a)
253+ maybeGen a = oneof [pure Nothing, Just <$> a]
254+
255+ maybeRecurse :: Int -> Gen a -> Gen (Maybe a)
256+ maybeRecurse n a
257+ | n < 1 = pure Nothing
258+ | otherwise = maybeGen $ resize (n `div` 10) a
259+
260+ f :: Int -> Gen Schema
261+ f n = do
262+ a <- maybeGen arbitraryText
263+ b <- maybeGen arbitraryText
264+ c <- maybeGen arbitraryText
265+ -- NOTE: The next two fields are empty to generate cleaner schemas,
266+ -- but note that this means we don't test e.g. the invertability
267+ -- of these fields.
268+ d <- pure Nothing -- _schemaDefinitions
269+ e <- pure mempty -- _otherPairs
270+
271+ f' <- maybeGen arbitraryPositiveScientific
272+ g <- maybeGen arbitraryScientific
273+ h <- arbitrary
274+ i <- maybeGen arbitraryScientific
275+ j <- arbitrary
276+
277+ k <- maybeGen (getPositive <$> arbitrary)
278+ l <- maybeGen (getPositive <$> arbitrary)
279+ m <- maybeGen arbitraryText
280+
281+ n' <- maybeGen (getPositive <$> arbitrary)
282+ o <- maybeGen (getPositive <$> arbitrary)
283+ p <- arbitrary
284+ q <- maybeRecurse n arbitrary
285+ r <- maybeRecurse n arbitrary
286+
287+ s <- maybeGen (getPositive <$> arbitrary)
288+ t <- maybeGen (getPositive <$> arbitrary)
289+ u <- arbitrary
290+ v <- maybeRecurse n arbitraryHashMap
291+ w <- maybeRecurse n arbitraryHashMap
292+ x <- maybeRecurse n arbitraryHashMap
293+ y <- maybeRecurse n arbitrary
294+
295+ z <- arbitrary
296+ a2 <- arbitrary
297+ b2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
298+ c2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
299+ d2 <- maybeRecurse n (_unNonEmpty' <$> arbitrary)
300+ e2 <- maybeRecurse n arbitrary
301+ pure Schema
302+ { _schemaVersion = a
303+ , _schemaId = b
304+ , _schemaRef = c
305+ , _schemaDefinitions = d
306+ , _schemaOther = e
307+
308+ , _schemaMultipleOf = f'
309+ , _schemaMaximum = g
310+ , _schemaExclusiveMaximum = h
311+ , _schemaMinimum = i
312+ , _schemaExclusiveMinimum = j
313+
314+ , _schemaMaxLength = k
315+ , _schemaMinLength = l
316+ , _schemaPattern = m
317+
318+ , _schemaMaxItems = n'
319+ , _schemaMinItems = o
320+ , _schemaUniqueItems = p
321+ , _schemaItems = q
322+ , _schemaAdditionalItems = r
323+
324+ , _schemaMaxProperties = s
325+ , _schemaMinProperties = t
326+ , _schemaRequired = u
327+ , _schemaDependencies = v
328+ , _schemaProperties = w
329+ , _schemaPatternProperties = x
330+ , _schemaAdditionalProperties = y
331+
332+ , _schemaEnum = z
333+ , _schemaType = a2
334+ , _schemaAllOf = b2
335+ , _schemaAnyOf = c2
336+ , _schemaOneOf = d2
337+ , _schemaNot = e2
338+ }