mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
test: add aggregations and mapping test
This commit is contained in:
@@ -87,7 +87,7 @@ commander
|
||||
commander
|
||||
.command('mapping <relativeSrcPath>')
|
||||
.option('-m, --mappingPath <relativeMappingPath>', 'Mapping Path')
|
||||
.option('-i, --ignoredTags <ignoredTags>', 'Ignored Tags')
|
||||
.option('-i, --ignoredTags <ignoredTags>', 'Ignored Tags (comma-separated)')
|
||||
.option('-a, --aggPath <relativeAggregationPath>', 'Aggregations Path')
|
||||
.option('-e, --errorPath <relativeErrorPath>', 'Error Path')
|
||||
.action(async (relativeSrcPath, options) => {
|
||||
|
||||
@@ -573,8 +573,12 @@ function readTypeTags(type: string, path: string, topTypeName: string, tags: Com
|
||||
* @param projectReflection a reflection of the project you want to get the ES Mappings from
|
||||
* @param ignoredTags the tag names for which the error output should be suppressed
|
||||
* @param showErrorOutput whether to print all errors in the command line or not
|
||||
* @param interfaceFilter only parse specific interfaces, this is for testing purposes
|
||||
*/
|
||||
export function generateTemplate(projectReflection: ProjectReflection, ignoredTags: string[], showErrorOutput = true):
|
||||
export function generateTemplate(projectReflection: ProjectReflection,
|
||||
ignoredTags: string[],
|
||||
showErrorOutput = true,
|
||||
interfaceFilter: string[] = []):
|
||||
// tslint:disable-next-line:completed-docs
|
||||
{ aggregations: AggregationSchema; errors: string[]; mappings: ElasticsearchTemplateCollection; } {
|
||||
errors = [];
|
||||
@@ -626,6 +630,13 @@ export function generateTemplate(projectReflection: ProjectReflection, ignoredTa
|
||||
Logger.error(`The interface ${_interface.name} is required to use an SCThingType as a type, please do so.`);
|
||||
}
|
||||
|
||||
// filter out
|
||||
if (interfaceFilter.length !== 0) {
|
||||
if (typeof interfaceFilter.find((it) => it === typeName) === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// init aggregation schema for type
|
||||
aggregations[typeName] = {
|
||||
aggs: {},
|
||||
|
||||
@@ -207,7 +207,7 @@ export interface ElasticsearchObject {
|
||||
* Fields that should be excluded in the _source field
|
||||
*/
|
||||
excludes: [
|
||||
'creation_date',
|
||||
'creation_date'
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user