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

Handle internal refs so they don't duplicate with different descriptions

Open davedoesdev opened this issue 5 years ago • 3 comments

Fixes #193 with new resolve option set to false

davedoesdev avatar Jul 04 '20 07:07 davedoesdev

I tried an approach which removed the description fields and then did a deep comparison. That does work but resulted in referencing interfaces that may be the same in structure but weren't originally referenced in the schema.

The JSON-Schema-Ref-Parser should (somehow) be maintaining the same object equality but set a different attribute.

I don't have a lot of time to work on this PR, I'm just using the quick fix to make my output sane. Feel free to close it if you like.

davedoesdev avatar Jul 04 '20 22:07 davedoesdev

I tried an approach which removed the description fields and then did a deep comparison. That does work but resulted in referencing interfaces that may be the same in structure but weren't originally referenced in the schema.

I think you can use a shallow comparison, right? Per (1) and (2) above, we should maintain referential identity, even after de-referencing, and if we don't, that should be fixed as part of this PR (or, as a pre-req for it).

bcherny avatar Jul 11 '20 23:07 bcherny

I think you can use a shallow comparison, right? Per (1) and (2) above, we should maintain referential identity, even after de-referencing, and if we don't, that should be fixed as part of this PR (or, as a pre-req for it).

Yes, I agree. Sorry, I just don't have time to work on this more. Perhaps someone else can help out?

davedoesdev avatar Jul 12 '20 07:07 davedoesdev