-
Notifications
You must be signed in to change notification settings - Fork 86
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently using the schema in ts looks like this. This feels like 2x the code necessary since you are declaring the schema twice.
With reflection the API would be more declarative and make this code much smaller and easier to understand.
Without reflection:
interface Album {
artist: string;
title: string;
year: number;
genres: string[];
outOfPublication: boolean;
}
class Album extends Entity {}
let schema = new Schema(Album, {
artist: { type: 'string' },
title: { type: 'string' },
year: { type: 'number' },
genres: { type: 'array' },
outOfPublication: { type: 'boolean' }
})
With reflection:
@Entity()
class Album {
@Property()
artist: string;
@Property()
title: string;
@Property()
year: string;
@Property()
genres: string[];
@Property()
outOfPublication: boolean;
}
let schema = new Schema(Album);
This is just an example but demonstrates how declarative and powerful reflection can make this api.
gothy, shubham-prasad, ChromeGG, OmgImAlexis, CaptainCodeman and 4 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request