-
Notifications
You must be signed in to change notification settings - Fork 5
OpenAPI model
Andriy Mykulyak edited this page Mar 20, 2023
·
8 revisions
- Model public API as TS interfaces, implement them separately. Do not expose implementation classes.
- Use
get()/set()to expose primitive attributes. Implement validation in setters. - Instead of collection attributes, model classes should expose a set of member functions
Basic version
readonly itemCount: number;
items(): IterableIterator<Item>;
itemAt(index: number): Item;
deleteItemAt(index: number): void;
clearItems(): void;Basic version
readonly itemCount: number;
itemKeys(): IterableIterator<string>;
items(): IterableIterator<[strig, Item]>;
hasItem(key: string): boolean;
getItem(key: string): Item | undefined;
getItemOrThrow(key: string): Item;
deleteItem(key: string): void;
clearItems(): void;