Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'fvm:source': t.list(t.String),
*/
import copy from './internationalization'
const validForm = yup.object().shape({
'dc:title': yup
.string()
.label(copy.name)
.required(copy.validation.name),
'dc:description': yup.string(),
// file: yup.array().min(1, 'gotta provide a file!'),
file: yup.array(),
'fvm:shared': yup.boolean(),
'fvm:child_focused': yup.boolean(),
'fvm:source': yup.array().of(yup.string()),
'fvm:recorder': yup.array().of(yup.string()),
})
export const toParse = [/^fvm:source/, /^fvm:recorder/]
export default validForm
describe('FieldArray', () => {
let schema = object({
colors: array()
.of(
object({
name: string().required(),
hexCode: string().required(),
})
)
.default(() => [{ name: 'red', hexCode: '#ff0000' }]),
})
class ColorList extends React.Component {
remove(index) {
this.props.arrayHelpers.remove(this.props.value[index])
}
render() {
const { value, name } = this.props
import * as Yup from "yup";
import { FILE_SIZE, FILE_TYPES } from "../../constants";
const validationSchema = Yup.object().shape({
title: Yup.string()
.min(3, "too short for title")
.required("*Title is required"),
description: Yup.string()
.min(8, "too short for description")
.required("*Description is required"),
location: Yup.string()
.min(8, "too short for location address")
.required("*Location is required"),
tags: Yup.array()
.max(10, "Only 10 tags are allowed")
.required("Provide at least one tag"),
file: Yup.mixed()
.required("*Avatar image is required")
.test(
"fileSize",
"Image too large, max 8mb",
value => value && value.size <= FILE_SIZE
)
.test(
"fileFormat",
"Images only",
value => value && FILE_TYPES.includes(value.type)
)
});
export const assetsShape = (t: i18next.TFunction) => {
return array()
.test(
CREATE_FUND_FIELDS.assets,
t("manager.create-fund-page.settings.validation.assets-share"),
(val: FundAssetPart[]) => {
return val.reduce((acc, next) => acc + next.percent, 0) == 100;
}
)
.required(t("manager.create-fund-page.settings.validation.assets-count"))
.min(2, t("manager.create-fund-page.settings.validation.assets-count"));
};
const jenkinsKpiColor = ({ theme, value }) => {
if (value < 70) return theme.palette.errorColor
if (value >= 70 && value < 90) return theme.palette.warnColor
return theme.palette.successColor
}
const Kpi = styled.span`
color: ${jenkinsKpiColor};
font-weight: 700;
font-size: 20px;
`
const schema = object().shape({
url: string().url().required(),
jobs: array(object({
label: string().required(),
path: string().required(),
branch: string()
})).required(),
interval: number(),
title: string(),
authKey: string()
})
export default class JenkinsJobHealth extends Component {
static defaultProps = {
interval: 1000 * 60 * 5,
title: 'Job Health'
}
state = {
import { Component } from 'react'
import fetch from 'isomorphic-unfetch'
import yup from 'yup'
import Widget from '../../widget'
import Counter from '../../counter'
import { basicAuthHeader } from '../../../lib/auth'
const schema = yup.object().shape({
url: yup.string().url().required(),
project: yup.string().required(),
repository: yup.string().required(),
interval: yup.number(),
title: yup.string(),
users: yup.array().of(yup.string()),
authKey: yup.string()
})
export default class BitbucketPullRequestCount extends Component {
static defaultProps = {
interval: 1000 * 60 * 5,
title: 'Bitbucket PR Count',
users: []
}
state = {
count: 0,
error: false,
loading: true
}
import { string, object, array } from 'yup';
import { ValidationResultsWrapper } from '../domain/Referee';
const tocSchema = object().shape({
home: string()
.trim()
.required(),
table_of_contents: array()
.of(
object().shape({
directory: string()
.trim()
.required(),
pages: array().of(
object().shape({
filename: string()
.trim()
.required(),
display_name: string().trim()
})
)
})
)
.required(),
default: yup.string().required('Required'),
}),
),
});
export const startPipelineSchema = yup.object().shape({
resources: yup.array().of(
yup.object().shape({
name: yup.string().required('Required'),
type: yup.string().required('Required'),
resourceRef: yup.object().shape({
name: yup.string().required('Required'),
}),
}),
),
parameters: yup.array().of(
yup.object().shape({
name: yup.string().required('Required'),
description: yup.string(),
default: yup.string().required('Required'),
}),
),
});
import * as yup from 'yup'
const submissionPageSchema = {
meta: yup.object().shape({
title: yup.string().required('Title is required'),
articleType: yup.string().required('Article type is required'),
subjects: yup
.array()
.min(1, `Choose at least 1 subject area`)
.max(2, `No more than 2 subject areas`)
.required('Subject area(s) required'),
}),
previouslyDiscussed: yup
.string()
.notOneOf(['', undefined], 'Please describe your previous interaction')
.nullable(),
previouslySubmitted: yup.array(
yup
.string()
.notOneOf([''], 'Article title is required')
.nullable(),
),
firstCosubmissionTitle: yup
return _this;
}
tslib_1.__decorate([
convector_core_model_1.ReadOnly()
], Participant.prototype, "type", void 0);
tslib_1.__decorate([
convector_core_model_1.ReadOnly(),
convector_core_model_1.Required(),
convector_core_model_1.Validate(yup.string())
], Participant.prototype, "name", void 0);
tslib_1.__decorate([
convector_core_model_1.ReadOnly(),
convector_core_model_1.Validate(yup.string())
], Participant.prototype, "msp", void 0);
tslib_1.__decorate([
convector_core_model_1.Validate(yup.array(exports.x509Identities))
], Participant.prototype, "identities", void 0);
return Participant;
}(convector_core_model_1.ConvectorModel));
exports.Participant = Participant;