krakenjs / hapi-openapi

Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Other
211 stars 75 forks source link

Handle multiple co-resident Swaggerized Hapi plugins #16

Closed garthk closed 9 years ago

garthk commented 9 years ago

I assemble and deploy Hapi apps like I imagine @hueniverse and @unclebob would have them:

I'd love to take your design-driven approach and hand my teams the Swagger Editor, but swaggerize-hapi presents an obstacle. The API document has to be embedded in the configuration which, for me, is:

I'm not sure whether this cuts across your architectural grain too much, but it strikes me you could:

The registration method could be as simple as:

server.plugins['swaggerize-hapi'].register(basePath, apiDocument)

I regret I might not be able to contribute code because procedures, but I'm getting good at raising specific and actionable bug reports. Would that be enough help?

tlivings commented 9 years ago

Would

the API document has to be embedded in the configuration...

be simply solved by allowing specification of a path instead of an object?

i.e.

server.pack.register({
    plugin: Swaggerize,
    options: {
        api: Path.join(__dirname, './config/pets.json'),
        handlers: Path.join(__dirname, './handlers')
    }
});
tlivings commented 9 years ago

(note: this is now done in alpha.8)

aredridel commented 9 years ago

Can this be closed now?

tlivings commented 9 years ago

No activity. Closing.

garthk commented 9 years ago

I'll check it out next time I throw together a REST API under Hapi. Thanks!