mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 22:05:01 +00:00
fix: broken config regex parsing
This commit is contained in:
parent
d231c72a5b
commit
9d4e9cf364
8 changed files with 29 additions and 54 deletions
|
@ -1,5 +1,5 @@
|
|||
import deepDiff from "deep-diff";
|
||||
import { either, fold } from "fp-ts/lib/Either";
|
||||
import { either, fold, isLeft } from "fp-ts/lib/Either";
|
||||
import { pipe } from "fp-ts/lib/pipeable";
|
||||
import * as t from "io-ts";
|
||||
import { noop } from "./utils";
|
||||
|
@ -106,6 +106,14 @@ export function validate(schema: t.Type<any>, value: any): StrictValidationError
|
|||
);
|
||||
}
|
||||
|
||||
export function parseIoTsSchema<T extends t.Type<any>>(schema: T, value: unknown): t.TypeOf<T> {
|
||||
const decodeResult = schema.decode(value);
|
||||
if (isLeft(decodeResult)) {
|
||||
throw report(decodeResult);
|
||||
}
|
||||
return decodeResult.right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes and validates the given value against the given schema while also disallowing extra properties
|
||||
* See: https://github.com/gcanti/io-ts/issues/322
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue