kenspirit / joi-to-json

Capable of converting different versions' joi object to json schema
MIT License
40 stars 18 forks source link

Support for title coming from Joi.meta #45

Closed bernardobridge closed 1 year ago

bernardobridge commented 1 year ago

First of all, great job on this library! 🎉

What

Similar to https://github.com/kenspirit/joi-to-json/issues/21, I'd like to be able to set something like:

Joi.meta({title: "Target URL"})

The reason this is useful is that title annotations will show up on various useful places. For example, I want to use the generated JSON schema in a VS Code extension, and the title annotation would show up as a header for the user. Everything else is already supported natively by Joi and well converted by the tool (e.g. Joi.example and Joi.description), but not title, since Joi doesn't support it natively. We would be able to do it with Joi.meta.

Unfortunately the code here https://github.com/kenspirit/joi-to-json/blob/master/lib/parsers/json.js#L739-L748 only exposes contentMediaType and format.

kenspirit commented 1 year ago

@bernardobridge Please check version 4.0.1