monokle-core icon indicating copy to clipboard operation
monokle-core copied to clipboard

Adjust readConfig() function to configurable rules

Open f1ames opened this issue 2 years ago • 0 comments

Follow up of https://github.com/kubeshop/monokle-core/issues/435.

The above task fixed some issues with readConfig() function but I realized it's still not aligned with configurable rules which accepts more extensive schema/types.

We have there now:

https://github.com/kubeshop/monokle-core/blob/89f220f48954148c9ade3ba201ea522e7370ba7e/packages/validation/src/config/parse.ts#L35

And should be:

  rules: z
    .record(
      z
        .boolean()
        .or(z.enum(['warn', 'err']))
        .or(
          z.tuple([
            z.boolean().or(z.enum(['warn', 'err'])),
            z
              .string()
              .or(z.number())
              .or(z.array(z.string()))
              .or(z.array(z.number())),
          ]),
        ),
    )
    .optional(),

f1ames avatar Jul 10 '23 15:07 f1ames