New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a description to a $ref object referencing an enum inlines the enum #472
Comments
Doing some deeper investigation into this - the reason that this happens is due to how the
It does this by merging the referenced schema into the current schema. I.e. When the parser attempts to look to see if the referenced schema has a definition (so that it can get the key and thus the name), it just does an json-schema-to-typescript/src/parser.ts Line 123 in 6e3fbca
So obviously if you have a simple just @JoshuaKGoldberg's fix (#473) works around this specifically for enum types by doing a lookup to see if the What's the correct, general solution for this? Well we probably need to keep a property which tracks the ref path for a given schema so that we can resolve it instead of looking up the key. |
I tried solving this (#521) but I ran into a problem in that the description comment gets put in the wrong spot (on the referenced schema, not on the referencing thing). The codebase is pretty complex so I'm not sure how to work through this more right now, but at least I've prototyped a generic solution for this. |
Perhaps related to #470, but not the same issue. Here, I'm seeing that when a
$ref
pointing to a defined enum has adescription
, the enum gets inlined.Note that if the
description
is removed fromproperties.first
, theexport type Shared = "a" | "b";
gets printed as expected.Actual
Expected
The text was updated successfully, but these errors were encountered: