I have an API splitted in several files and I have used swagger-cli to combine those files into one (to use that file in API consumer services/applications)
When any API file is referenced using $ref that file is exported (included) in the new API file as component (that's good). But those files that are referenced without using $ref are exported (included in the bundled file) keeping the reference to the file.
Example
Let's suppose that we have OpenApi.yaml that has this endpoint deffinition
[...]
/offering:
post:
[...]
requestBody:
description: This is an offering
required: true
content:
application/json:
schema:
$ref: ./Offering.yaml
[...]
When I combine the API files (executing: swagger-cli bundle OpenApi.yaml --outfile CombinedApi.yaml --type yaml) this is the outcome (CombinedApi.yaml):
As we can see the discriminator.mapping.local and discriminator.mapping.international keeps files references. That means that we need those files so the combination in one file is not valid
Expected behavior
I would expect than those files referenced without using $ref would be exported in a way (maybe the same way that $ref ones) that doesn't keep the reference to the files.
Problem
I have an API splitted in several files and I have used swagger-cli to combine those files into one (to use that file in API consumer services/applications) When any API file is referenced using
$ref
that file is exported (included) in the new API file as component (that's good). But those files that are referenced without using$ref
are exported (included in the bundled file) keeping the reference to the file.Example
Let's suppose that we have OpenApi.yaml that has this endpoint deffinition
This is Offering.yaml
When I combine the API files (executing: swagger-cli bundle OpenApi.yaml --outfile CombinedApi.yaml --type yaml) this is the outcome (CombinedApi.yaml):
As we can see the
discriminator.mapping.local
anddiscriminator.mapping.international
keeps files references. That means that we need those files so the combination in one file is not validExpected behavior
I would expect than those files referenced without using
$ref
would be exported in a way (maybe the same way that$ref
ones) that doesn't keep the reference to the files.Expected outcome: