How to use json-schema-merge-allof - 1 common examples

To help you get started, we’ve selected a few json-schema-merge-allof examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rjsf-team / react-jsonschema-form / packages / core / src / utils.js View on Github external
export function retrieveSchema(schema, definitions = {}, formData = {}) {
  let resolvedSchema = resolveSchema(schema, definitions, formData);
  if ("allOf" in schema) {
    try {
      resolvedSchema = mergeAllOf({
        ...resolvedSchema,
        allOf: resolvedSchema.allOf,
      });
    } catch (e) {
      console.warn("could not merge subschemas in allOf:\n" + e);
      const { allOf, ...resolvedSchemaWithoutAllOf } = resolvedSchema;
      return resolvedSchemaWithoutAllOf;
    }
  }
  const hasAdditionalProperties =
    resolvedSchema.hasOwnProperty("additionalProperties") &&
    resolvedSchema.additionalProperties !== false;
  if (hasAdditionalProperties) {
    return stubExistingAdditionalProperties(
      resolvedSchema,
      definitions,

json-schema-merge-allof

Simplify your schema by combining allOf into the root schema, safely.

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Popular json-schema-merge-allof functions