Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/lib/config/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,29 @@ export const treeDecoder = d.struct({
export const metaDecoder = d.partial({
attributes: d.array(attributeDecoder),
trees: d.array(treeDecoder),
structures: d.array(treeDecoder),
});

interface DirType {
title: string;
id: string;
dirs: Array<DirType>;
}

const dirDecoder: d.Decoder<unknown, DirType> = d.lazy('dirDecoder', () =>
d.struct({
title: d.string,
id: d.string,
dirs: d.array(dirDecoder),
}),
);

export const structureDecoder = d.struct({
title: d.string,
id: d.string,
dirs: d.array(dirDecoder),
})

// config
export const apiConfigDecoder = d.struct({
host: d.string,
Expand Down Expand Up @@ -125,5 +146,6 @@ export type ValidationSeverity = d.TypeOf<typeof validationSeverityDecoder>;

export type Meta = d.TypeOf<typeof metaDecoder>;
export type Tree = d.TypeOf<typeof treeDecoder>;
export type Structure = d.TypeOf<typeof structureDecoder>;
export type Attribute = d.TypeOf<typeof attributeDecoder>;
export type AttributeValue = d.TypeOf<typeof attributeValueDecoder>;
13 changes: 13 additions & 0 deletions src/lib/domain/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,23 @@ export interface Tree {
attributes: string[];
}

interface StructureDir {
title: string;
id: string;
dirs: StructureDir[];
}

export type Structure = {
title: string;
id: string;
dirs: StructureDir[];
}

export interface ProjectData {
features: Feature[];

attributes?: Attribute[];
trees?: Tree[];
structure?: Structure;
metaFilePath: string;
}
1 change: 1 addition & 0 deletions src/lib/yaml/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const entityDecoder = d.intersect(
}),
)(
d.partial({
path: d.string,
type: featureTypeDecoder,
'specs-unit': d.record(d.array(assertionDecoder)),
definitions: d.record(d.array(d.string)),
Expand Down