Skip to content

Commit

Permalink
fix: removed id from loaded schema to resolve the ref more than once …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
CptSchnitz committed Sep 4, 2024
1 parent 3d04ca0 commit 380d842
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ function loadSpecificSchema(relativePath: string): JSONSchema {
throw createConfigError(`schemaNotFoundError`, `Schema not found at path`, { schemaPath: fullPath });
}

return JSON.parse(fs.readFileSync(fullPath, { encoding: 'utf-8' })) as JSONSchema;
const schema = JSON.parse(fs.readFileSync(fullPath, { encoding: 'utf-8' })) as JSONSchema;

delete schema.$id;

return schema;
}

export async function loadSchema(schema: JSONSchema): ReturnType<typeof refParser.dereference> {
Expand Down

0 comments on commit 380d842

Please sign in to comment.