function getSchemaObject({
  schema: { required, properties },
  level,
  prefix
}) {
  const renderProperties = properties;
  if (properties) {
    return Object.entries(renderProperties).flatMap(
      ([name, value], i) => getSchemaEntry({
        schema: { ...value, name, optional: required && !required.includes(name) },
        level: level + 1,
        prefix: `${prefix}`
      })
    );
  }
  return [];
}
function getSchemaArray({
  schema: { name, items, required, allOf, properties },
  level,
  prefix
}) {
  if (items) {
    return getSchemaEntry({
      schema: { ...items, name, optional: required && !required.includes(name) },
      level: level + 1,
      prefix
    });
  }
  return [];
}
function getSchemaEntry({
  schema,
  level,
  prefix
}) {
  if (schema.type === "object") {
    return getSchemaObject({ schema, level, prefix });
  } else if (schema.type === "array") {
    return getSchemaArray({ schema, level, prefix });
  }
  return `${prefix}.${schema.name}`;
}
function getJSONSchemaFieldsList(schema, prefix) {
  return getSchemaEntry({ schema, level: 0, prefix }).toSorted((a, b) => a.localeCompare(b));
}
export {
  getJSONSchemaFieldsList
};
//# sourceMappingURL=json-field-list.js.map
