Skip to content
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

do not limit readhandlers to js / make it public #1

Open
hans-d opened this issue Sep 5, 2014 · 2 comments
Open

do not limit readhandlers to js / make it public #1

hans-d opened this issue Sep 5, 2014 · 2 comments

Comments

@hans-d
Copy link

hans-d commented Sep 5, 2014

See:

These limit the require to only js files.
Would be nice if, eg via an optional parameter, also other files could be included, eg coffee (only make extension configurable, being able to use coffee should be done outside this lib)

Perhaps even better if also the function could be made public, so that it could be used in construction of the handler object. Eg to do

swaggerize = require 'swaggerize-express'
builder = require 'swaggerize-builder'
yaml = require 'js-yaml'
fs = require 'fs'
_ = require 'lodash'

readApi = (file) ->
    raw = fs.readFileSync file
    yaml.safeLoad raw

buildHandler = (dir) ->
    _.merge {}, [
        builder.constructHandler dir, 'js'
        builder.constructHandler dir, 'coffee'
    ]

module.exports = (options) ->
    swaggerize
        api: readApi options.spec
        docspath: options.docUrl
        handlers: buildHandlers './controllers'


@tlivings
Copy link
Contributor

Fair enough.

@hans-d
Copy link
Author

hans-d commented Sep 10, 2014

flexible reader in #8

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

2 participants