maxdome / swagger-combine

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

Tags not included from the subsequent swaggers #62

Open NikhilNanjappa-zz opened 5 years ago

NikhilNanjappa-zz commented 5 years ago

Running the command

swagger-combine config.json -o combined.json

with the following configuration

{
  "swagger": "2.0",
  "info": {
    "title": "Swagger Combine Rename Example",
    "version": "1.0.0"
  },
  "apis": [
    {
      "url": "http://petstore.swagger.io/v2/swagger.json"
    },
    {
      "url": "https://api.apis.guru/v2/specs/medium.com/1.0.0/swagger.yaml",
      "tags": {
        "rename": {
          "Users": "People"
        }
      }
    }
  ]
}

Issue

The "tags" are not getting included from the swagger files under apis.

Note: It will only include those tags that are present in the config file and not from the subsequent swaggers.

cupofcoffe commented 5 years ago

not sure if i understood this 100%, but yes none of the tags were added into a merged swagger from the tags presented in the header of each swagger json registered in the apis URL, this removes not only the tags but also documentation about these tag (description) from the merged swagger. You still have option to add this manually into config swagger, but than you always have to merge all the changes manually. .defaultsDeep(this.combinedSchema, .pick(schema, ['tags']));

in combineSchemas method

would do this trick but do not know if addtags / renametags will still do that job to manipulate with those "header" tags. if not, modification of addTags / renameTags will be required

equalspeterd commented 5 years ago

FWIW, this problem exists in OAS 3.x as well (now that -parser supports 3.x). Having to manage tags in the combine.config file is a pain, since I define a set of micro services as separate specifications, and a utility spec for re-usable fragments. I would like to keep the micro service descriptions where it belongs. Also, The same seems to be true with securitySchemes (missing from combined spec).

Ghazgkull commented 3 years ago

Is this the same as the issue I raised more recently? If so, it's fixed in the 1.3.0 release of this library, provided you pass the --includeGlobalTags option. https://github.com/maxdome/swagger-combine/issues/87

equalspeterd commented 3 years ago

the tags portion seems to be, however:

 Also, The same seems to be true with securitySchemes (missing from combined spec).

may be a separate issue.