mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018-2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -129,7 +129,13 @@ export function getProjectReflection(srcPath: PathLike): ProjectReflection {
|
||||
const inputFiles = app.expandInputFiles([srcPath.toString()]);
|
||||
|
||||
// get project reflection from input files
|
||||
return app.convert(inputFiles);
|
||||
const result = app.convert(inputFiles);
|
||||
|
||||
if (typeof result === 'undefined') {
|
||||
throw new Error('Project reflection could not be generated.');
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* Copyright (C) 2018-2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -29,6 +29,10 @@ import {RouteWithMetaInformation} from './common';
|
||||
export async function gatherRouteInformation(reflection: ProjectReflection): Promise<RouteWithMetaInformation[]> {
|
||||
const routes: RouteWithMetaInformation[] = [];
|
||||
|
||||
if (!Array.isArray(reflection.children)) {
|
||||
throw new Error('Project reflection doesn\'t contain any modules.');
|
||||
}
|
||||
|
||||
await asyncPool(2, reflection.children, async (module: any) => {
|
||||
if (Array.isArray(module.children) && module.children.length > 0) {
|
||||
await asyncPool(2, module.children, (async (node: any) => {
|
||||
@@ -49,6 +53,10 @@ export async function gatherRouteInformation(reflection: ProjectReflection): Pro
|
||||
}
|
||||
});
|
||||
|
||||
if (routes.length === 0) {
|
||||
throw new Error('No route information found.');
|
||||
}
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
@@ -163,6 +171,10 @@ export function generateDocumentationForRoute(routeWithInfo: RouteWithMetaInform
|
||||
export function getNodeMetaInformationMap(projectReflection: ProjectReflection): NodesWithMetaInformation {
|
||||
const nodes: NodesWithMetaInformation = {};
|
||||
|
||||
if (typeof projectReflection.children === 'undefined') {
|
||||
throw new Error('Project reflection doesn\'t contain any modules.');
|
||||
}
|
||||
|
||||
// iterate over modules
|
||||
projectReflection.children.forEach((module: any) => {
|
||||
if (Array.isArray(module.children) && module.children.length > 0) {
|
||||
|
||||
@@ -108,6 +108,10 @@ export class Converter {
|
||||
export function getValidatableTypesFromReflection(projectReflection: ProjectReflection): string[] {
|
||||
const validatableTypes: string[] = [];
|
||||
|
||||
if (typeof projectReflection.children === 'undefined') {
|
||||
throw new Error('Project reflection doesn\'t contain any modules.');
|
||||
}
|
||||
|
||||
// iterate over modules
|
||||
projectReflection.children.forEach((module) => {
|
||||
if (Array.isArray(module.children) && module.children.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user