mac- / ratify

A Hapi plugin for validating the schema of path, query, request body, and response body params using JSON-schema
MIT License
71 stars 27 forks source link

swagger-js-codegen not working on api doc root #50

Open no-more opened 8 years ago

no-more commented 8 years ago

Hi,

I'm not sure if this is an issue with ratify or something else, but when I try to generate code with swagger-js-codegen and pointing to the root documentation generated by ratify it generate an error (TypeError: Cannot read property 'forEach' of undefined) But if I point to a specific route in the doc the generation works fine, but this would mean I need to generate seperatly each routes witch is not what I want.

This is what I have when pointing to the api-docs: { apiVersion: '0.1.0', swaggerVersion: '1.2', apis: [ { path: '/api/1.0.0/users' }, { path: '/api/1.0.0/connexion/checkAndDecodeSession' }, { path: '/api/1.0.0/connexion/login' }, { path: '/api/1.0.0/connexion/logout' } ] }

At least if /api/1.0.0/connexion/* could all be grouped into a single end point /api/1.0.0/connexion. Maybe I'm doing something wrong because I don't understand why they are generated a separated routes. According to my understanding checkAndDecodeSession, login and logout should be methods of connexion endpoint and not individual endpoints. Is there any way to help ratify to defined the correct endpoint ?

Thanks for your help.