Simplify check for defaults and add another test
This commit is contained in:
parent
a85d5e7050
commit
c463dc58c2
1 changed files with 7 additions and 2 deletions
|
|
@ -8,8 +8,7 @@ import { JsonObject } from "./jsonPathUtils";
|
|||
*/
|
||||
export function generateDefaultValue(schema: JsonSchemaType): JsonValue {
|
||||
if ("default" in schema) {
|
||||
// Ensure we don't return undefined even if schema.default is undefined
|
||||
return schema.default === undefined ? null : schema.default;
|
||||
return schema.default;
|
||||
}
|
||||
|
||||
if (!schema.required) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue