maxdome / swagger-combine

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

Name conflict in definitions #123

Open ctrl-Felix opened 2 years ago

ctrl-Felix commented 2 years ago

I am currently trying to combine a couple of different swagger files.

Now I keep getting Name conflict in definitions Because some swagger files have the same definitions. Is there a possibility to rename or merge them?

RafaelBarrero commented 1 year ago

I don't know if is too late, buy try deleting the security definitions from each swagger file and add it dynamically by code.

Like:

const swaggerDocument = require('/path/to/swagger.json');
const securityDefinitions = {
    OAuth2: {
        ..... // Security definition for OAuth2
    },
};
const security = [{
  OAuth2: [], // Security for OAuth2
}];
swaggerDocument.securityDefinitions = securityDefinitions;
swaggerDocument.security = security;