I’ve imported an OpenAPI document into Postman and then connected the resulting API entry to a GitLab repository.
In doing so, I selected the root document, which is at docs/API/OpenAPI.yaml. Postman then wanted me to push changes to the git repository … which included Postman creating a second copy of the OpenAPI document but, this time, in the root of the repository.
Why did it do that? As far as I can tell, from looking at the git repository, it is a complete copy of the original file … which means I’ve now got to keep two files in sync???
Hi @pcolmer ,
From my experience with the API Builder when Git repos are involved, it is better to start with an empty repo and then import your API documentation.
Same experience goes when using an existing API in Postman.
As for what happened in your case, it is similar to adding Git to an existing folder on your computer . Postman now is trying to reconciliate the content that existed prior to connecting to Git.
I am assuming the imported spec (prior to setting the Git repo) was sitting in the root of the API hierarchy in Postman.
Since you specified docs/API/OpenAPI.yaml as root document, then that’s your source of truth and that’s the file Postman will use going forward. I recommend you double check that all your changes are in that file and it’s up to date.
Hint: The entire resulting file hierarchy (post moving to Git) is located in an autogenerated .postman/api file. You won’t see the file in Postman, but you will see it in your repo. Postman uses that file for configuration. Any possible misconfiguration will definitely show up there.
Unless the root definition file docs/API/openapi.yaml is referencing something from the openapi.yaml, it should be safe to be removed (I recommend backing it up somewhere though… you never know if you end up needing it ).
I recommend you delete it using the Postman API Builder UI. .postman/api is auto-generated and managed by the editor. Touching these auto-generated files is never safe (Old experience from Visual Studio lol).