From f10e43acf90634953f0d5bc5ce2eec625cecf72f Mon Sep 17 00:00:00 2001 From: Mathias Lykkegaard Lorenzen Date: Fri, 17 Mar 2023 16:33:46 +0100 Subject: [PATCH 1/4] Update types.ts --- source/types.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/source/types.ts b/source/types.ts index 2a954e5d..7bb28269 100644 --- a/source/types.ts +++ b/source/types.ts @@ -161,8 +161,31 @@ export interface MutationOptions { decodeDatesAsIso?: boolean; } +type SimpleTypeSchemaProperty = { + type: "string"|"boolean"|"number"|"array"; + format?: string; + description?: string; + alias_for?: string; +} +type ArrayTypeSchemaProperty = { + type: "array"|"mapped_array"; + items: RefSchemaProperty; + description?: string; + alias_for?: string; +} +type TypedSchemaProperty = + SimpleTypeSchemaProperty | + ArrayTypeSchemaPropert; +type RefSchemaProperty = { + ["$ref"]: string +} +type SchemaProperties = { + [key: string]: + TypedSchemaProperty | + RefSchemaProperty; +} export interface Schema { - properties: Data; + properties: SchemaProperties; default_projections: string[]; primary_key: string[]; required: string[]; From da95641ff8a5f3874cf53e5ea3210b4b6b8beb27 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 21 Mar 2023 10:23:40 +0100 Subject: [PATCH 2/4] Fix for typing of API. --- source/types.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/source/types.ts b/source/types.ts index 7bb28269..6a3f8e6b 100644 --- a/source/types.ts +++ b/source/types.ts @@ -162,28 +162,24 @@ export interface MutationOptions { } type SimpleTypeSchemaProperty = { - type: "string"|"boolean"|"number"|"array"; + type: "string" | "boolean" | "number" | "array"; format?: string; description?: string; alias_for?: string; -} +}; type ArrayTypeSchemaProperty = { - type: "array"|"mapped_array"; + type: "array" | "mapped_array"; items: RefSchemaProperty; description?: string; alias_for?: string; -} -type TypedSchemaProperty = - SimpleTypeSchemaProperty | - ArrayTypeSchemaPropert; +}; +type TypedSchemaProperty = SimpleTypeSchemaProperty | ArrayTypeSchemaProperty; type RefSchemaProperty = { - ["$ref"]: string -} + ["$ref"]: string; +}; type SchemaProperties = { - [key: string]: - TypedSchemaProperty | - RefSchemaProperty; -} + [key: string]: TypedSchemaProperty | RefSchemaProperty; +}; export interface Schema { properties: SchemaProperties; default_projections: string[]; From 8b63501e52245793813af0140f4d6a3e4c20fd9b Mon Sep 17 00:00:00 2001 From: Mathias Lykkegaard Lorenzen Date: Tue, 21 Mar 2023 12:59:04 +0100 Subject: [PATCH 3/4] Update source/types.ts Co-authored-by: Lars Johansson --- source/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/types.ts b/source/types.ts index 6a3f8e6b..ecdd29e3 100644 --- a/source/types.ts +++ b/source/types.ts @@ -162,7 +162,7 @@ export interface MutationOptions { } type SimpleTypeSchemaProperty = { - type: "string" | "boolean" | "number" | "array"; + type: "string" | "boolean" | "number" | "integer" | "variable"; format?: string; description?: string; alias_for?: string; From 8d34aad14271156b74a0a183d3dcdf123c9f2225 Mon Sep 17 00:00:00 2001 From: Mathias Lykkegaard Lorenzen Date: Tue, 21 Mar 2023 12:59:43 +0100 Subject: [PATCH 4/4] Update source/types.ts Co-authored-by: Lars Johansson --- source/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/source/types.ts b/source/types.ts index ecdd29e3..6121a5fa 100644 --- a/source/types.ts +++ b/source/types.ts @@ -166,6 +166,7 @@ type SimpleTypeSchemaProperty = { format?: string; description?: string; alias_for?: string; + default?: string; }; type ArrayTypeSchemaProperty = { type: "array" | "mapped_array";