git.iko.soy/rowtype-yoga/purescript-yoga-http-api
on feat/custom-type-errors help sign in
refactor: Make validate take OpenAPISpec type instead of Foreign

Now users can call: validate (buildOpenAPISpec proxy config unit) The function converts OpenAPISpec to Foreign internally using unsafeCoerce since it's already a Foreign object at runtime.

commit933da8303e6a9ce994de5f5317e5fd3d45e9e77f authorMark <mark.eibes@gmail.com> dateSun 8 Feb 2026, 00:46 (8 months ago) parent09330df
1 file changed+4−2
test/Test/OpenAPIValidation.purs+4−2
test/Test/OpenAPIValidation.purs+4−2
@@ -1,8 +1,10 @@
11module Test.OpenAPIValidation (validate) where
22
33import Foreign (Foreign)
4+import Unsafe.Coerce (unsafeCoerce)
5+import Yoga.HTTP.API.Route.OpenAPI (OpenAPISpec)
46
57foreign import validateImpl :: Foreign -> { errors :: Array { message :: String } }
68
7−validate :: Foreign -> { errors :: Array { message :: String } }
8−validate = validateImpl
9+validate :: OpenAPISpec -> { errors :: Array { message :: String } }
10+validate spec = validateImpl (unsafeCoerce spec)