json-schema-library icon indicating copy to clipboard operation
json-schema-library copied to clipboard

Error with object schema with field `id`

Open Blechlawine opened this issue 5 months ago • 2 comments

I have a complex schema with some fields called id and i get an error: schema.id.startsWith is not a function on https://github.com/sagold/json-schema-library/blob/363c43acade792d9c16fc2c1f2630101e36c308b/lib/compile/index.ts#L79 . With the debugger in the browser i can see that it has the id field with this object as schema:

{
  "type": "string"
}

I think the check here: https://github.com/sagold/json-schema-library/blob/363c43acade792d9c16fc2c1f2630101e36c308b/lib/compile/index.ts#L76 could be expanded to be false if schema is similar to the above mentioned schema.

Blechlawine avatar Sep 16 '24 14:09 Blechlawine