Skip to content

Prioritize exclude over include instead of 'if include else exclude' #114

Description

@kaleocheng

the current strategy ignores exclude if include exists: https://github.com/maxdome/swagger-combine/blob/master/src/SwaggerCombine.js#L87-L99

It may be confusing if someone has the configuration like this:
(include all paths under /api/products excpet for /api/products/{id}/recommendation)

{
  "openapi": "3.0.0",
   .....
  "apis": [
    {
      "url": "./docs/api.yaml",
      "paths": {
        "exclude": [
          "^/api/products/{id}/recommendation"
        ],
        "include": [
          "^/api/products(/.*|)$"
        ]
      }
    }
   ]
}

To me it makes more sense to use

if (include.paths) {
....
}

if (exclude.paths) {
....
}

instead of if include else if exclude

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions