swagger-api / swagger-node

Swagger module for node.js
http://swagger.io
Apache License 2.0
3.97k stars 584 forks source link

why not work when i add the other yaml to swagger directory #440

Open kazaff opened 8 years ago

kazaff commented 8 years ago

my project have more than one api file, but, swagger-node only parse swagger.yaml by default.

how to config to let it parse all yaml file that in swagger directory?

abekim commented 7 years ago

I'm contemplating a similar issue with a complex application with multiple endpoints. My guess (and my current approach) is to have a pre-build script that merges multiple yaml configuration files into /api/swagger/swagger.yaml.

I will likely namespace the definitions and endpoints in any swagger.yaml files outside the base API definition to prevent any name collision. For example, given the following API definition layout:

swagger
└── swagger.yaml
└── user
    └── swagger.yaml

A /path/foo in swagger/user/swagger.yaml will be merged into swagger.yaml as /user/path/foo and a Profile definition in the user yaml file, as user_Profile (or some similar convention).

It's not perfect and may be non-trivial work, so I would love to hear others' opinions on how they would approach the said problem.

kazaff commented 7 years ago

@abekim talk is cheep, show me your code, haha~~ a joke, i like your approach. in my project, finally, i use the same method to solve it as yours.