Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async runWithResolved(
target: IParsedResult | object | string,
opts: IRunOpts = {},
): Promise {
let results: IRuleResult[] = [];
let parsedResult: IParsedResult | IParsedResult>;
if (!isParsedResult(target)) {
parsedResult = {
parsed: parseYaml(typeof target === 'string' ? target : safeStringify(target, undefined, 2)),
getLocationForJsonPath: getLocationForJsonPathYaml,
// we need to normalize the path in case path with forward slashes is given
source: opts.resolve?.documentUri && normalize(opts.resolve.documentUri),
};
} else {
parsedResult = target;
}
results = results.concat(formatParserDiagnostics(parsedResult.parsed.diagnostics, parsedResult.source));
const documentUri = opts.resolve && opts.resolve.documentUri;
const refDiagnostics: IRuleResult[] = [];
const resolved = new Resolved(
parsedResult,
await this._resolver.resolve(parsedResult.parsed.data, {
const content = React.useMemo(() => safeStringify(additional, undefined, 2), [additional]);
Object.entries(validations).map(([name, value]) => {
if (typeof value === 'object') {
value = safeStringify(value, undefined, 2);
}
return (
{name}: {String(value)}
);
}),
[validations]
{Object.entries(validations).map(([k, v]) => {
let type = typeof v;
if (k === 'default' && ['object', 'boolean'].includes(type)) {
v = safeStringify(v);
type = typeof v;
}
if (type === 'boolean') {
return (
<div>
{k}: {v.toString()}
</div>
);
}
if (type !== 'object') {
return (
<div>
{k}: {v}</div>