这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nine-cups-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": patch
---

valibot: use `.strictObject()` instead of `.objectWithRest()` when additional properties are not allowed
Original file line number Diff line number Diff line change
Expand Up @@ -995,17 +995,17 @@ export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({
value: v.pipe(v.number(), v.integer())
}, v.pipe(v.number(), v.integer()));

export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({
item: v.optional(v.boolean()),
error: v.optional(v.union([
v.string(),
v.null()
])),
hasError: v.optional(v.pipe(v.boolean(), v.readonly())),
data: v.optional(v.record(v.string(), v.never()))
}, v.never());
data: v.optional(v.strictObject({}))
});

export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({
item: v.optional(v.union([
v.string(),
v.null()
Expand All @@ -1015,7 +1015,7 @@ export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({
v.null()
])),
hasError: v.optional(v.pipe(v.boolean(), v.readonly()))
}, v.never());
});

export const vOneOfAllOfIssue = v.union([
v.intersect([
Expand Down Expand Up @@ -1117,16 +1117,16 @@ export const vOneOfAllOfIssueWritable = v.union([
vGenericSchemaDuplicateIssue1SystemString
]);

export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({
item: v.optional(v.boolean()),
error: v.optional(v.union([
v.string(),
v.null()
])),
data: v.optional(v.record(v.string(), v.never()))
}, v.never());
data: v.optional(v.strictObject({}))
});

export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({
item: v.optional(v.union([
v.string(),
v.null()
Expand All @@ -1135,7 +1135,7 @@ export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRes
v.string(),
v.null()
]))
}, v.never());
});

/**
* This is a reusable parameter
Expand All @@ -1144,12 +1144,12 @@ export const vSimpleParameter = v.string();

export const vCompositionWithOneOfAndProperties = v.intersect([
v.union([
v.objectWithRest({
v.strictObject({
foo: vSimpleParameter
}, v.never()),
v.objectWithRest({
}),
v.strictObject({
bar: vNonAsciiStringæøåÆøÅöôêÊ字符串
}, v.never())
})
]),
v.object({
baz: v.union([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,17 +993,17 @@ export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({
value: v.pipe(v.number(), v.integer())
}, v.pipe(v.number(), v.integer()));

export const vGenericSchemaDuplicateIssue1SystemBoolean = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({
item: v.optional(v.boolean()),
error: v.optional(v.union([
v.string(),
v.null()
])),
hasError: v.optional(v.pipe(v.boolean(), v.readonly())),
data: v.optional(v.record(v.string(), v.never()))
}, v.never());
data: v.optional(v.strictObject({}))
});

export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({
item: v.optional(v.union([
v.string(),
v.null()
Expand All @@ -1013,7 +1013,7 @@ export const vGenericSchemaDuplicateIssue1SystemString = v.objectWithRest({
v.null()
])),
hasError: v.optional(v.pipe(v.boolean(), v.readonly()))
}, v.never());
});

export const vOneOfAllOfIssue = v.union([
v.intersect([
Expand Down Expand Up @@ -1121,16 +1121,16 @@ export const vOneOfAllOfIssueWritable = v.union([
vGenericSchemaDuplicateIssue1SystemString
]);

export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({
item: v.optional(v.boolean()),
error: v.optional(v.union([
v.string(),
v.null()
])),
data: v.optional(v.record(v.string(), v.never()))
}, v.never());
data: v.optional(v.strictObject({}))
});

export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRest({
export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({
item: v.optional(v.union([
v.string(),
v.null()
Expand All @@ -1139,7 +1139,7 @@ export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.objectWithRes
v.string(),
v.null()
]))
}, v.never());
});

/**
* This is a reusable parameter
Expand All @@ -1148,12 +1148,12 @@ export const vSimpleParameter = v.string();

export const vCompositionWithOneOfAndProperties = v.intersect([
v.union([
v.objectWithRest({
v.strictObject({
foo: vSimpleParameter
}, v.never()),
v.objectWithRest({
}),
v.strictObject({
bar: vNonAsciiStringæøåÆøÅöôêÊ字符串
}, v.never())
})
]),
v.object({
baz: v.union([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import * as v from 'valibot';

export const vBar: v.GenericSchema = v.objectWithRest({
export const vBar: v.GenericSchema = v.strictObject({
bar: v.union([
v.array(v.lazy(() => {
return vBar;
})),
v.null()
])
}, v.never());
});

export const vFoo = v.objectWithRest({
export const vFoo = v.strictObject({
foo: vBar
}, v.never());
});
Loading
Loading