Skip to content

Commit d435bfb

Browse files
ffMathygismya
andauthored
feat: Improve strong-typing of Schema types (#86)
* Update types.ts * Fix for typing of API. * Update source/types.ts Co-authored-by: Lars Johansson <gismya@gmail.com> * Update source/types.ts Co-authored-by: Lars Johansson <gismya@gmail.com> --------- Co-authored-by: Lars Johansson <gismya@gmail.com>
1 parent 7bfc877 commit d435bfb

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

source/types.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,28 @@ export interface MutationOptions {
161161
decodeDatesAsIso?: boolean;
162162
}
163163

164+
type SimpleTypeSchemaProperty = {
165+
type: "string" | "boolean" | "number" | "integer" | "variable";
166+
format?: string;
167+
description?: string;
168+
alias_for?: string;
169+
default?: string;
170+
};
171+
type ArrayTypeSchemaProperty = {
172+
type: "array" | "mapped_array";
173+
items: RefSchemaProperty;
174+
description?: string;
175+
alias_for?: string;
176+
};
177+
type TypedSchemaProperty = SimpleTypeSchemaProperty | ArrayTypeSchemaProperty;
178+
type RefSchemaProperty = {
179+
["$ref"]: string;
180+
};
181+
type SchemaProperties = {
182+
[key: string]: TypedSchemaProperty | RefSchemaProperty;
183+
};
164184
export interface Schema {
165-
properties: Data;
185+
properties: SchemaProperties;
166186
default_projections: string[];
167187
primary_key: string[];
168188
required: string[];

0 commit comments

Comments
 (0)