-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Migrate ApplicationType
to alternative enum structure
#218
Conversation
8b6acb8
to
f1db53a
Compare
f1db53a
to
393af29
Compare
/** | ||
* @description Rights of Way Order - Apply to move or close a path | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method doesn't work (@description
per-enum)...
/** | ||
* @description | ||
* { | ||
* "wtt": "Works to trees", | ||
* "wtt.consent": "Consent to carry out works to a tree with a Tree Preservation Order", | ||
* "wtt.notice": "Notification of proposed works to a tree in a Conservation Area" | ||
* } | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...but this does (JSON in @description
of parent).
Have been doing some reading on enums in JSON Schema this morning & definitely seems like simple But I did find one option that I quite like - this Since we know some type of improved public documentation is also on our near-roadmap here, maybe this could be a two-for-one? I suspect we'd have to globally set |
Thanks @jessicamcinchak - that link was super helpful, and lead to me this thread which suggested a combination of Take a look at aa7f59a - this looks like the solution we're looking for? 🤞 It looks like ts-json-schema-generator will combine plain string unions, but convert named types to a list of |
ApplicationType
to alternative enum structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very happy with the latest ApplicationType
changes - let's merge this then we can work through other enums 🙂
Frustratingly JSONSchema doesn't support description annotations per-enum (which is very likely what lead us to this more complex structure we currently use).
You can see in this PR enums with
@description
notation (PA, PP) not being pulled through into the generated schema.For WTT, I've tried adding the descriptions as JSON within the
@description
block. This works and allows us to encode this information in the schema, but it's not typesafe or particularly consumer friendly. It might be a decent compromise though? Thoughts very welcome!Update: The above is now outdated, please see #218 (comment) - I have a solution which works well, we'll go with this going forward.