xddq / schema2typebox

Creating TypeBox code from JSON schemas
MIT License
66 stars 15 forks source link

feature request: change import style based on package.json "type" #40

Open croconut opened 8 months ago

croconut commented 8 months ago

Library version:

1.7.1

JSON schema version: draft-04

I am willing to contribute to fix the issue 💚

The current behavior

It currently doesn't generate JS at all.

The expected behavior

If it generates JS (e.g. the feature request for JS creation is completed), it would be nice to resolve exported code as either common js or esm based on a combination of the (same directory or flag-argument) package.json's type & the output file's extension. At the moment, I'm have to locally wrap the code generator with some extras:

Basically, I can't get my org to use TS so my workflow is sharing schemas with API consumers and use @typebox's compiler to do the live type checking.