Skip to content

Support custom JSON-schema extensions #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

Open
bcherny opened this issue Mar 31, 2016 · 5 comments
Open

Support custom JSON-schema extensions #2

bcherny opened this issue Mar 31, 2016 · 5 comments

Comments

@bcherny
Copy link
Owner

bcherny commented Mar 31, 2016

No description provided.

@monolithed
Copy link
Contributor

monolithed commented Mar 7, 2017

@bcherny, is there any way to convert a JSON object as is?

I mean:

let json = {
   "x": 0
}
convert('Foo', json);
interface Foo {
   x: number
}

@bcherny
Copy link
Owner Author

bcherny commented Mar 7, 2017

That is outside of jstt's responsibility, though you can probably use something like https://www.npmjs.com/package/generate-schema, and pipe its output into jstt.

@bcherny bcherny closed this as completed Mar 7, 2017
@bcherny bcherny reopened this Mar 7, 2017
@monolithed
Copy link
Contributor

@bcherny, thanks!

@TheLarkInn
Copy link

I spent a bit of time looking at how the parser works, and was curious how you might imagine a plugin system? Would this be as granular as supporting custom JSONTypes?

@bcherny
Copy link
Owner Author

bcherny commented Jun 9, 2018

@TheLarkInn Sorry about the delayed response. If you want a plugin system that can add support for/override handling of a particular JSONSchema node type, you'd have to add support for that node type at a few layers:

A question to start with might be: does a typical plugin need to hook into all of these steps? If not, we might want to go more granular.

I'd start by putting together a few use cases for JSON-Schema-to-TypeScript plugins. Then we can think through how to design the API (visitor pattern, or otherwise), and sketch out how the types would work to enforce compile time safety for plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants