How can I share my components between 2 openapi specification? ($ref: 'otherAPI.yml#/components/schemas/User')


In my IDE I can share openapi components between API’s, by referencing the other openapi spec yaml file:

$ref: 'otherAPI.yml#/components/schemas/User'

Since POSTman isn’t file-based, I can’t seem to get this work.
Even though this seems to be a standard openapi 3 feature.

Is here any way this could be done?
Have the same model in different API’s, without this feature means have a lot of redundant info.

Any help/info welcome!


Postman doesn’t yet support using $ref across multiple OAS files. This is something we’ve received feedback on previously and is a feature that’s been planned. In the interim you could look at tools to generate a flattened OAS file such as openapi-ref-flatten - npm. That could at least allow you to keep your models organized in different files, and then have a consolidated output yml that you can import to Postman.

1 Like