fix: make schema more lenient while parsing public data structures

This commit is contained in:
Andrew Bastin
2023-11-14 21:24:25 +05:30
parent e93a37c711
commit b1982d74a6
6 changed files with 163 additions and 84 deletions

View File

@@ -52,6 +52,7 @@ export const HoppRESTRequest = createVersionedEntity({
export type HoppRESTRequest = InferredEntity<typeof HoppRESTRequest>
// TODO: Handle the issue with the preRequestScript and testScript type check failures on pre-commit
const HoppRESTRequestEq = Eq.struct<HoppRESTRequest>({
id: undefinedEq(S.Eq),
v: S.Eq,
@@ -59,11 +60,11 @@ const HoppRESTRequestEq = Eq.struct<HoppRESTRequest>({
body: lodashIsEqualEq,
endpoint: S.Eq,
headers: mapThenEq(
(arr) => arr.filter((h) => h.key !== "" && h.value !== ""),
(arr) => arr.filter((h: any) => h.key !== "" && h.value !== ""),
lodashIsEqualEq
),
params: mapThenEq(
(arr) => arr.filter((p) => p.key !== "" && p.value !== ""),
(arr) => arr.filter((p: any) => p.key !== "" && p.value !== ""),
lodashIsEqualEq
),
method: S.Eq,