lbovet/typson

support functions from comments

Closed this issue · 1 comments

Would it be possible to create a function in the comments?

e.g.,

/**
* @default [Function Date.now]
*/

The use case, I'm using the json-schema results to convert to mongoose schema and wanted the current date as the default. Currently it outputs the following:

{ default: "[Function" }

Let me know if you want me to take the deep dive into your code and do a pull request.

I was reading that JSON doesn't support functions. So, I just did the following for functions:

/**
* @default [Function=Date.now]
*/

And then I parse it correctly on my side. So, I don't think this is an issue with typson.