maxdome/swagger-combine

Base Path defintion not respected during combine

Closed this issue · 0 comments

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"
}
}
}
}
}
}