@@ -206,10 +206,21 @@ validateJsonRepr sschema dpath jr = case jr of
206 let newPath = dpath <> [DKey (knownFieldName f)]
206 let newPath = dpath <> [DKey (knownFieldName f)]
207 validateJsonRepr (knownFieldSchema f) newPath d
207 validateJsonRepr (knownFieldSchema f) newPath d
209− ReprUnion u -> case sschema of
209+ ReprUnion u -> pure () -- case sschema of
210− SSchemaUnion ss -> case ss of
210+ -- SSchemaUnion ss -> case ss of
212+ -- let JSONPath path = demotedPathToText dpath
211− SNil -> vWarning $ mmSingleton (demotedPathToText dpath)
213+ -- void $ vWarning $ mmSingleton path
212− $ pure "union handling error, please report this as bug"
214+ -- $ pure "union handling error, please report this as bug"
213− SCons s stl -> case u of
215+ -- SCons s stl -> case umatch' s u of
216+ -- Nothing -> case urestrict u of
217+ -- Nothing -> fail "impossible to urestrict union, please report this as a bug"
220+ -- toUnion :: Sing ss -> Union JsonRepr ss -> JsonRepr ('SchemaUnion ss)
221+ -- toUnion _ = ReprUnion
222+ -- validateJsonRepr (SSchemaUnion stl) dpath $ toUnion stl x
214− This x -> validateJsonRepr s dpath x
223+ -- Just x -> validateJsonRepr s dpath x
215− That u' -> validateJsonRepr (SSchemaUnion ss) dpath (ReprUnion u')
224+
225+umatch' :: UElem a as i => Sing a -> Union f as -> Maybe (f a)
226+umatch' _ u = umatch u