kubeshop/monokle-core

Adjust readConfig() function to configurable rules

Opened this issue · 0 comments

f1ames commented

Follow up of #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:

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

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(),