maxdome / swagger-combine

Combines multiple Swagger schemas into one dereferenced schema.
MIT License
132 stars 36 forks source link

Base Path defintion not respected during combine #81

Closed dawinter closed 5 years ago

dawinter commented 5 years ago

If a swagger file has a base path for all APIs of the file, the base path need to be evaluated and added during combine.

Example: { "swagger": "2.0", "info": { "title": "Combiner", "version": "1.0.0" }, "apis": [ { "url": "file://C:/Source/sample1.yaml" }, { "url": "file://C:/Source/sample2.yaml", } ] }

sample1.yaml: swagger: '2.0' info: title: test version: 1.0.0 paths: /api/v1/clusters/: get: operationId: ListClusters1 summary: List available clusters responses: 200: description: OK

sample2.yaml: swagger: '2.0' info: title: test version: 1.0.0 basePath: /api/v1 paths: /clusters2/: get: operationId: ListClusters2 summary: List available clusters responses: 200: description: OK

Result should be:

{ "swagger": "2.0", "info": { "title": "Watson Personalized Search Public API", "version": "1.0.0" }, "paths": { "/api/v1/clusters/": { "get": { "operationId": "ListClusters1", "summary": "List available clusters", "responses": { "200": { "description": "OK" } } } }, "/api/v1/clusters2/": { "get": { "operationId": "ListClusters2", "summary": "List available clusters", "responses": { "200": { "description": "OK" } } } } } }