Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types and test small improvement #430

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 25 additions & 25 deletions metaschema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,39 @@ export class Schema {
static STORE: Array<string>;
static ALLOW: Array<string>;

static from(raw: object, namespaces?: Array<Model>): Schema;
public static from(raw: object, namespaces?: Array<Model>): Schema;
static extractSchema(def: object): Schema | null;

root: null;
kind: Kind;
references: Set<string>;
relations: Set<Relation>;
scope: Scope;
allow: Allow;
parent: string;
indexes: object;
public kind: Kind;
public references: Set<string>;
public relations: Set<Relation>;
public scope: Scope;
public allow: Allow;
public parent: string;
public indexes: object;
options: {
validate: Function | null;
format: Function | null;
parse: Function | null;
serialize: Function | null;
};
custom: object;
fields: object;
name: string;
namespaces: Set<Model>;
public custom: object; // custom metadata
public fields: object;
public name: string;
public namespaces: Set<Model>;

constructor(name: string, raw: object, namespaces?: Array<Model>);
get types(): object;
checkConsistency(): Array<string>;
public get types(): object;
public checkConsistency(): Array<string>;
findReference(name: string): Schema;
check(value: any): SchemaError;
toInterface(): string;
public check(value: any): SchemaError;
public toInterface(): string;
attach(...namespaces: Array<Model>): void;
detouch(...namespaces: Array<Model>): void;
toString(): string;
toJSON(): object;
validate(value: any, path: string): SchemaError;
public toString(): string;
public toJSON(): object;
public validate(value: any, path: string): SchemaError;
}

export function createSchema(name: string, src: string): Schema;
Expand All @@ -84,14 +84,14 @@ export function loadModel(
export function saveTypes(outputFile: string, model: Model): Promise<void>;

export class Model {
types: object;
entities: Map<string, object>;
database: object;
public types: object;
public entities: Map<string, object>;
public database: object;
order: Set<string>;
warnings: Array<string>;
public warnings: Array<string>;

constructor(types: object, entities: Map<string, object>, database?: object);
preprocess(): void;
public preprocess(): void;
reorderEntity(name: string, base?: string): void;
get dts(): string;
public get dts(): string;
}
3 changes: 2 additions & 1 deletion test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ metatests.test('Collections: check value with long form', (test) => {

metatests.test('Collections: multiple nested arrays', (test) => {
const defs1 = {
Entity: {},
Struct: {},

name: {
first: { type: 'string' },
last: { type: 'string' },
Expand Down