Simplify check for defaults and add another test

This commit is contained in:
Ola Hungerford 2025-03-18 06:23:25 -07:00
commit c463dc58c2

View file

@ -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) {