Skip to content

Commit fed86eb

Browse files
fix: type in SchemaObject can be an array
Fixes #2.
1 parent 90fe4d1 commit fed86eb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/schema.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ type UnknownSchema = {
9393
type?: undefined,
9494
};
9595

96+
type UnionSchema = {
97+
type: ("object" | "string" | "number" | "integer" | "array" | "null" | "boolean")[],
98+
} & (
99+
Partial<Omit<ObjectSchema, "type">>
100+
& Partial<Omit<StringSchema, "type">>
101+
& Partial<Omit<NumberSchema, "type">>
102+
& Partial<Omit<IntegerSchema, "type">>
103+
& Partial<Omit<ArraySchema, "type">>
104+
& Partial<Omit<NullSchema, "type">>
105+
& Partial<Omit<BooleanSchema, "type">>
106+
)
107+
96108
/**
97109
* The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12.
98110
*/
@@ -103,5 +115,6 @@ export type SchemaObject = Schema & (
103115
IntegerSchema |
104116
ArraySchema |
105117
NullSchema |
106-
BooleanSchema
118+
BooleanSchema |
119+
UnionSchema
107120
) | (ReferenceObject & UnknownSchema);

0 commit comments

Comments
 (0)