Boris Cherny
Boris Cherny
This does seem like a bug. In your case, I think you actually want `extends`, which would fix it for you: https://borischerny.com/json-schema-to-typescript-browser/#schema=%7B%0A%20%20%22$schema%22:%20%22http://json-schema.org/draft-07/schema#%22,%0A%20%20%22$id%22:%20%22test%22,%0A%20%20%22definitions%22:%20%7B%0A%20%20%20%20%22Thing%22:%20%7B%0A%20%20%20%20%20%20%22type%22:%20%22object%22,%0A%20%20%20%20%20%20%22properties%22:%20%7B%0A%20%20%20%20%20%20%20%20%22name%22:%20%7B%20%22type%22:%20%22string%22%20%7D%0A%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%22required%22:%20%5B%22name%22%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%22Vehicle%22:%20%7B%0A%20%20%20%20%20%20%22type%22:%20%22object%22,%0A%20%20%20%20%20%20%22extends%22:%20%7B%20%22$ref%22:%20%22#/definitions/Thing%22%20%7D,%0A%20%20%20%20%20%20%22properties%22:%20%7B%0A%20%20%20%20%20%20%20%20%22year%22:%20%7B%20%22type%22:%20%22integer%22%20%7D%0A%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%22required%22:%20%5B%22year%22%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%22Car%22:%20%7B%0A%20%20%20%20%20%20%22type%22:%20%22object%22,%0A%20%20%20%20%20%20%22extends%22:%20%7B%20%22$ref%22:%20%22#/definitions/Vehicle%22%20%7D,%0A%20%20%20%20%20%20%22properties%22:%20%7B%0A%20%20%20%20%20%20%20%20%22numDoors%22:%20%7B%20%22type%22:%20%22integer%22%20%7D%0A%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%22required%22:%20%5B%22numDoors%22%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%22Truck%22:%20%7B%0A%20%20%20%20%20%20%22type%22:%20%22object%22,%0A%20%20%20%20%20%20%22extends%22:%20%7B%20%22$ref%22:%20%22#/definitions/Vehicle%22%20%7D,%0A%20%20%20%20%20%20%22properties%22:%20%7B%0A%20%20%20%20%20%20%20%20%22numAxles%22:%20%7B%20%22type%22:%20%22integer%22%20%7D%0A%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%22required%22:%20%5B%22numAxles%22%5D%0A%20%20%20%20%7D%0A%20%20%7D,%0A%20%20%22oneOf%22:%20%5B%7B%20%22$ref%22:%20%22#/definitions/Car%22%20%7D,%20%7B%20%22$ref%22:%20%22#/definitions/Truck%22%20%7D%5D%0A%7D
@arnauddrain `extends` is an old keyword that has been removed in modern JSON Schema versions. The website you linked doesn't seem to implement it correctly. If your validator supports it,...
Merged https://github.com/bcherny/json-schema-to-typescript/pull/603
Fix included in v15.0.0.
Dup of https://github.com/bcherny/json-schema-to-typescript/issues/258
Thanks for the contribution! Is there a benefit of this approach for your use case? Presumably, this would *add* a dependency to your project.
Log highlighting is something you can only enable locally, in development -- I'm not sure it would make much sense in production, unless you have a use case in mind?...
If you're hitting this a lot, would you mind reporting an issue through `/bug` and posting the feedback id here?
This is fixed in 0.2.38. Restart to update!
That's a cool idea. What were you thinking of making your script do?