const SuccessResponseSchema = <A, I, R>(BodySchema: S.Schema<A, I, R>) => S.Struct({
foo: S.extend(
S.Struct({
"@attributes": S.Struct({
errorCode: S.Literal("0"),
})
}),
BodySchema
)
}).pipe(S.transform(
S.EitherFromSelf({ right: BodySchema, left: S.Never }),
{
decode: (input) => {
const { "@attributes": _, ...body } = input.foo;
return Either.right(body);
},
encode: (body) => {
return null as any
},
strict: false,
}
))
const SuccessResponseSchema = <A, I, R>(BodySchema: S.Schema<A, I, R>) => S.Struct({
foo: S.extend(
S.Struct({
"@attributes": S.Struct({
errorCode: S.Literal("0"),
})
}),
BodySchema
)
}).pipe(S.transform(
S.EitherFromSelf({ right: BodySchema, left: S.Never }),
{
decode: (input) => {
const { "@attributes": _, ...body } = input.foo;
return Either.right(body);
},
encode: (body) => {
return null as any
},
strict: false,
}
))