Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stringify(obj: any, options: any = {}): string {
// do not quote 'y' and 'yes' for older yaml versions
return yaml
.safeDump(obj, { noCompatMode: true, ...options })
.replace(/^- - /gm, "\n- - ")
.trim();
},
};
updateSelectedAction = action => {
const { ajv } = this.state;
if (action.schema) {
this.setState({
schema: jsyaml.safeDump(action.schema),
payload: jsyaml.safeDump(jsonSchemaDefaults(action.schema)),
validate: ajv.compile(action.schema),
});
} else {
this.setState({ schema: null, payload: null, validate: null });
}
};
updateSelectedAction = action => {
const { ajv } = this.state;
if (action.schema) {
this.setState({
schema: jsyaml.safeDump(action.schema),
payload: jsyaml.safeDump(jsonSchemaDefaults(action.schema)),
validate: ajv.compile(action.schema),
});
} else {
this.setState({ schema: null, payload: null, validate: null });
}
};