How to update an existing collection with a Swagger/OpenAPI spec without overwriting tests?

Hi everyone!

I have a bit of a workflow challenge. I have a robust Postman collection filled with developed regression tests and scripts for my project. Recently, I needed to integrate changes from our updated Swagger (swagger.json) file.

When I use the API Spec import feature, Postman generates a brand-new collection. I don’t want to lose my existing scripts or manually copy-paste them into a new collection every time the spec changes.

My Goal: I want to “sync” or import the Swagger definitions directly into my existing collection to update the request structures while keeping my current test scripts intact.

What I’ve tried:

  • Importing via the “API” tab (creates a new collection).

  • Importing the file directly (also creates a new collection).

Is there a built-in way to “Update” an existing collection from a spec file rather than generating a new one? Or is there a recommended workaround to avoid losing my regression suite?

Tagging @danny-dainton for any insights on the best workflow for this. Thanks in advance!

1 Like

Hey @sakthisarvani-r :waving_hand:

There a few different methods of keeping those elements in sync without creating new ones each time that you import a spec.

You can generate a Collection form the Spec:

Once created, it’s linked and you have the option to update the Collection to reflect new changes:

This is a dummy example of adding a new endpoint to a Collection and syncing this to the linked Spec file:


You can also programmatically do this via the Postman API, this offers a more coded approach to keeping elements in sync.

With each of the methods, you would need to explore this to see if this could be something to use in your own context. It’s not going to be a straight drop in replace for your workflow but experimenting with it might get you what you need. :folded_hands:

Hi @danny-dainton

I have a collection that already contains a large suite of regression tests. However, this collection was built manually and is not currently “linked” to an API definition in Postman.

I now have a swagger.json file that I want to use as the source of truth (OpenAPI spec). When I try to import the spec, Postman only gives me the option to “Generate a new collection.”

My problem: I don’t see an option to choose my existing collection during the import process.

1 Like

Have you also tried generating a Spec from a Collection?

When you import an element (Collection, Spec, Environment, Etc.) into Postman, you’re creating something new. It doesn’t have an association with an exciting element.

Did you take a look at the API and the methods available?

1 Like