• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

horiuchi / dtsgenerator / 5572977410

pending completion
5572977410

Pull #555

github

web-flow
Merge 0bee8e546 into 24d8037fd
Pull Request #555: Add support for additionalProperties: false on empty objects

677 of 779 branches covered (86.91%)

2 of 2 new or added lines in 1 file covered. (100.0%)

1117 of 1227 relevant lines covered (91.04%)

4522.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/core/typeTree.ts
1
import { Schema } from './type';
2

3
export interface TypeTree {
4
    children: Map<string, TypeTree>;
5
    schema?: Schema;
6
}
7

8
export function buildTypeTree(schemas: IterableIterator<Schema>): TypeTree {
3✔
9
    const tree: TypeTree = buildTree();
345✔
10
    for (const type of schemas) {
345✔
11
        setTypeToTree(tree, type.id.toNames(), type);
1,758✔
12
    }
13
    if (tree.children.size === 0) {
345✔
14
        throw new Error('There is no schema in the input contents.');
3✔
15
    }
16
    return tree;
342✔
17
}
18

19
function setTypeToTree(tree: TypeTree, paths: string[], type: Schema): void {
20
    if (paths.length === 0) {
1,758!
21
        throw new Error('The paths is nothing for set the type to TypeTree.');
×
22
    }
23
    let t: TypeTree = tree;
1,758✔
24
    for (const key of paths) {
1,758✔
25
        let next = t.children.get(key);
7,149✔
26
        if (next === undefined) {
7,149✔
27
            next = buildTree();
2,721✔
28
            t.children.set(key, next);
2,721✔
29
        }
30
        t = next;
7,149✔
31
    }
32
    t.schema = type;
1,758✔
33
}
34

35
function buildTree(): TypeTree {
36
    return {
3,066✔
37
        children: new Map(),
38
    };
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc