-
Notifications
You must be signed in to change notification settings - Fork 78
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
Load JS modules and JSON using require(). #344
base: master
Are you sure you want to change the base?
Conversation
Note that this is possibly surplus to requirements (although maybe useful anyway?) given that you can just convert your module in to JSON and pipe it to speccy anyway, e.g.
Feel free to close if not useful, converting to JSON is a reasonable workaround. |
I think that for other purposes being able to load JS modules would still be useful, e.g. I've just written a test runner for Jest which uses |
Any thoughts on this one @pderaaij? |
1740255
to
8ffa153
Compare
@djtarazona Rebased in latest changes from master, resolving conflicts. |
I'm not sure if there is a need for sharing API specifications in JS files. But I see no harm nevertheless. I am wondering if the format flag is required as it make things more verbose and complicated.Perhaps we can simplify this. @elyobo could you have a look at it or else I can have a look, but that will be a bit later this week. |
Thanks @pderaaij. The use case isn't so much sharing them as JS files, but using JS files to generate them (composition and comments are handy). Ultimately these will be converted to a more shareable format (e.g. The |
Fixes #343.
Minimal tests are also provided for JS module loading, but there don't currently seem to be tests for stdin processing.
One major change here that could be avoided is that JSON is also directly loaded via
require()
instead of handing over the content to theyaml
parser. This can be avoided if desirable.