diff --git a/lib/config/builder/list.ts b/lib/config/builder/list.ts
index 7803d66..f8a7788 100644
--- a/lib/config/builder/list.ts
+++ b/lib/config/builder/list.ts
@@ -5,9 +5,8 @@ import {
InputSpec,
UniqueBy,
ValueSpecList,
- ValueSpecListOf,
} from "../config-types";
-import { guardAll, typeFromProps } from "../../util";
+import { guardAll } from "../../util";
/**
* Used as a subtype of Value.list
@@ -116,6 +115,11 @@ export class List extends IBuilder {
default: Record[];
range: string;
spec: {
+ select: {
+ name: string;
+ description: string | null;
+ warning: string | null;
+ }
variants: Variants<{
[key: string]: { name: string; spec: InputSpec };
}>;
diff --git a/lib/config/config-types.ts b/lib/config/config-types.ts
index 903b305..b9a18ec 100644
--- a/lib/config/config-types.ts
+++ b/lib/config/config-types.ts
@@ -159,17 +159,22 @@ export interface ListValueSpecObject {
export type UniqueBy =
| null
- | undefined
| string
| { any: readonly UniqueBy[] | UniqueBy[] }
| { all: readonly UniqueBy[] | UniqueBy[] };
export interface ListValueSpecUnion {
+ select: {
+ name: string
+ description: null | string
+ warning: null | string
+ }
variants: { [key: string]: { name: string; spec: InputSpec } };
- /** this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id*/
+ /** a handlebars template for labeling each union list item */
displayAs: null | string;
+ /** indicates whether duplicates can be permitted in the list */
uniqueBy: UniqueBy;
- /** this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list*/
+ /** the default variant when creating a new union instance in the list*/
default: null | string;
}
diff --git a/lib/util/propertiesMatcher.ts b/lib/util/propertiesMatcher.ts
index 2c13c02..ab49b8c 100644
--- a/lib/util/propertiesMatcher.ts
+++ b/lib/util/propertiesMatcher.ts
@@ -103,7 +103,6 @@ const matchVariant = object({
const recordString = dictionary([string, unknown]);
const matchDefault = object({ default: unknown });
const matchNullable = object({ nullable: literals(true) });
-const matchPattern = object({ pattern: string });
const rangeRegex = /(\[|\()(\*|(\d|\.)+),(\*|(\d|\.)+)(\]|\))/;
const matchRange = object({ range: string });
const matchIntegral = object({ integral: literals(true) });
diff --git a/scripts/oldSpecToBuilder.ts b/scripts/oldSpecToBuilder.ts
index dd7325e..31a9423 100644
--- a/scripts/oldSpecToBuilder.ts
+++ b/scripts/oldSpecToBuilder.ts
@@ -253,10 +253,21 @@ export default async function makeFileContent(
name:${JSON.stringify(value.name || null)},
range:${JSON.stringify(value.range || null)},
spec: {
+ select: {
+ "name": ${JSON.stringify(
+ value?.spec?.tag?.["name"] || null
+ )},
+ "description": ${JSON.stringify(
+ value?.spec?.tag?.["description"] || null
+ )},
+ "warning": ${JSON.stringify(
+ value?.spec?.tag?.["warning"] || null
+ )},
+ },
variants: ${variants},
displayAs: ${JSON.stringify(
- value?.spec?.["display-as"] || null
- )},
+ value?.spec?.["display-as"] || null
+ )},
uniqueBy: ${JSON.stringify(value?.spec?.["unique-by"] || null)},
default: ${JSON.stringify(value?.spec?.default || null)},
},