mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 16:13:06 +00:00
fix: filter tags override inherited type tags
This commit is contained in:
@@ -67,4 +67,17 @@ export const typemap: ElasticsearchTypemap = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* If the string is a tag type
|
||||
*/
|
||||
export function isTagType(str: string): boolean {
|
||||
for (const key in typemap) {
|
||||
if (typemap.hasOwnProperty(key) && typeof typemap[key][str] !== 'undefined') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export const dynamicTypes = ['any', 'unknown'];
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap';
|
||||
import {premaps} from './config/premap';
|
||||
import {settings} from './config/settings';
|
||||
import {dynamicTypes, ElasticsearchDataType, typemap} from './config/typemap';
|
||||
import {dynamicTypes, ElasticsearchDataType, isTagType, typemap} from './config/typemap';
|
||||
import {AggregationSchema, ESNestedAggregation} from './types/aggregation';
|
||||
import {
|
||||
ElasticsearchDynamicTemplate,
|
||||
@@ -275,7 +275,11 @@ function handleDeclarationReflection(decl: DeclarationReflection,
|
||||
}
|
||||
} else if (decl.type instanceof Type) { // if the object is a type, so we are dealing with a PROPERTY
|
||||
// get inherited tags
|
||||
const tags = (inheritedTags ?? []).length > 0 ? inheritedTags! : getCommentTags(decl, path, topTypeName);
|
||||
const tags = (inheritedTags ?? []).length > 0
|
||||
? (typeof inheritedTags!.find(it => isTagType(it.tagName)) !== 'undefined'
|
||||
? inheritedTags!
|
||||
: [...inheritedTags ?? [], ...getCommentTags(decl, path, topTypeName)])
|
||||
: getCommentTags(decl, path, topTypeName);
|
||||
|
||||
return handleType(decl.type, new Map(generics), path, topTypeName, tags);
|
||||
} else if (decl.kindString === 'Enumeration member') {
|
||||
|
||||
Reference in New Issue
Block a user