utils#reqErrorMsg TypeScript Examples

The following examples show how to use utils#reqErrorMsg. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: APICUDPage.helpers.ts    From one-platform with MIT License 6 votes vote down vote up
step1Schema = {
  id: yup.string().notRequired(),
  name: yup.string().trim().required(reqErrorMsg('Name')),
  description: yup.string().trim().required(reqErrorMsg('Description')),
  slug: yup.string().notRequired(),
  owners: yup
    .array(
      yup
        .object({
          group: yup.mixed<ApiEmailGroup>().oneOf(Object.values(ApiEmailGroup)).required(),
          mid: yup
            .string()
            .when('group', {
              is: (value: string) => value === ApiEmailGroup.MAILING_LIST,
              then: yup.string().email(emailErrorMsg(`Owner's mailing list`)).trim().required(),
              otherwise: yup.string().trim().required(),
            })
            .required(reqErrorMsg('Mid')),
          email: yup.string().trim().required(),
        })
        .required(reqErrorMsg('Owners'))
    )
    .required(reqErrorMsg('Owners'))
    .min(1, 'Minimum one owner required'),
}
Example #2
Source File: APICUDPage.helpers.ts    From one-platform with MIT License 5 votes vote down vote up
step2Schema = {
  schemas: yup
    .array(
      yup
        .object({
          id: yup.string().notRequired(),
          name: yup.string().trim().required(reqErrorMsg('Schema name')),
          description: yup.string().trim().required(reqErrorMsg('Schema description')),
          appURL: yup.string().url().trim().required(reqErrorMsg('Application URL')),
          docURL: yup.string().url().trim(),
          flags: yup.object({
            isInternal: yup.bool().default(false),
            isDeprecated: yup.bool().default(false),
          }),
          category: yup
            .mixed<ApiCategory>()
            .oneOf(Object.values(ApiCategory))
            .required(reqErrorMsg('API Category')),
          environments: yup
            .array(
              yup.object({
                id: yup.string().notRequired(),
                name: yup.string().trim().required(reqErrorMsg('Name')),
                slug: yup.string().notRequired(),
                apiBasePath: yup.string().url().trim().required(reqErrorMsg('API Base Path')),
                schemaEndpoint: yup.string().url().trim(),
                headers: yup.array(
                  yup.object({
                    id: yup.string().notRequired(),
                    key: yup.string().trim(),
                    value: yup.string().trim(),
                  })
                ),
                isPublic: yup.bool(),
              })
            )
            .required(reqErrorMsg('Environments')),
        })
        .required(reqErrorMsg('Schema'))
    )
    .min(1)
    .required(reqErrorMsg('Schema')),
}