Seprating accounts and categories routes
This commit is contained in:
@@ -31,8 +31,9 @@ function buildResource(rawSchemas: RJSFSchema, resourceName: string) {
|
||||
if (is_reference(prop)) {
|
||||
resolveReference(rawSchemas, resource, prop);
|
||||
} else if (is_union(prop)) {
|
||||
for (let i in prop.oneOf) {
|
||||
resolveReference(rawSchemas, resource, prop.oneOf[i]);
|
||||
const union = prop.hasOwnProperty("oneOf") ? prop.oneOf : prop.anyOf;
|
||||
for (let i in union) {
|
||||
resolveReference(rawSchemas, resource, union[i]);
|
||||
}
|
||||
} else if (is_enum(prop)) {
|
||||
for (let i in prop.allOf) {
|
||||
@@ -92,11 +93,11 @@ function is_array(prop: any) {
|
||||
}
|
||||
|
||||
function is_union(prop: any) {
|
||||
return prop.hasOwnProperty('oneOf');
|
||||
return prop.hasOwnProperty('oneOf') || prop.hasOwnProperty('anyOf');
|
||||
}
|
||||
|
||||
function is_enum(prop: any) {
|
||||
return prop.hasOwnProperty('allOf');
|
||||
return prop.hasOwnProperty('enum');
|
||||
}
|
||||
|
||||
function get_reference_name(prop: any) {
|
||||
@@ -112,7 +113,8 @@ function has_descendant(rawSchemas:RJSFSchema, resource: RJSFSchema, property_na
|
||||
let subresourceName = get_reference_name(resource);
|
||||
return has_descendant(rawSchemas, buildResource(rawSchemas, subresourceName), property_name);
|
||||
} else if (is_union(resource)) {
|
||||
for (const ref of resource.oneOf!) {
|
||||
const union = resource.hasOwnProperty("oneOf") ? resource.oneOf : resource.anyOf;
|
||||
for (const ref of union) {
|
||||
return has_descendant(rawSchemas, ref, property_name)
|
||||
}
|
||||
} else if (is_enum(resource)) {
|
||||
@@ -183,4 +185,3 @@ function get_property_by_path(rawSchemas: RJSFSchema, resource: RJSFSchema, path
|
||||
path.substring(pointFirstPosition + 1)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user