Add descriptions for schema-defined functions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import descriptions from "./descriptions.json" assert {type: "json"};
|
||||
|
||||
export const RootContext = "root";
|
||||
const FunctionContext = "functions";
|
||||
|
||||
/**
|
||||
* Get a description for a built-in context
|
||||
@@ -13,3 +14,12 @@ export function getDescription(context: string, key: string): string | undefined
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
return (descriptions as any)[context]?.[key]?.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a description for a context function
|
||||
* This will not include functions defined by the expressions library (e.g. `contains`, `fromJSON`, etc.)
|
||||
* @param name Name of the function, for example `hashFiles`
|
||||
*/
|
||||
export function getFunctionDescription(name: string): string | undefined {
|
||||
return getDescription(FunctionContext, name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user