Fix formatting

This commit is contained in:
Ola Hungerford
2025-02-27 22:08:04 -07:00
parent 44982e6c97
commit 82bbe58a46
3 changed files with 20 additions and 8 deletions

View File

@@ -7,7 +7,6 @@ import { JsonObject } from "./jsonPathUtils";
* @returns A default value matching the schema type, or null for non-required fields
*/
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;
@@ -29,7 +28,7 @@ export function generateDefaultValue(schema: JsonSchemaType): JsonValue {
return [];
case "object": {
if (!schema.properties) return {};
const obj: JsonObject = {};
Object.entries(schema.properties)
.filter(([, prop]) => prop.required)