Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
7 months ago

Updating OpenAPI file assigns new Stoplight stable IDs

Originally posted by user markg to the Stoplight Community on 04/20/2023 at 18:14 ET.

Hi there, I uploaded an OpenAPI spec generated by a third-party tool to get started. I then copied the Stoplight stable IDs that Stoplight generated into our OpenAPI spec, so that our resources and models would stay at the same URLs.

But when I uploaded it again (which I couldn't find a way to do other than like, copying the OpenAPI spec text into the Code tab in the Studio), it assigns totally new Stoplight IDs to them, overwriting the ones that were assigned before.

Is there a way to update our OpenAPI file without these stable IDs getting overwritten? Thank you!

  • Skinghar (Staff) [05/16/2023 - 10:26 ET]

    Hello Markg, After deeper investigation and speaking with engineering. You are seeing expected behavior. They shared a suggestion of the following to try to assist you. 

    "What they could do is: remove all old documents they want to replace with new ones import new documents (seems like they could use the import feature we have, no need to copy&paste anything, https://docs.stoplight.io/docs/platform/58bf119ddff88-work-with-files#import-file) now, in code view, manually re-assign all the IDs publish the changes"

    Hope this helps!

  • Stoplight's avatar
    Stoplight
    Community Manager

    Skinghar (Staff) [05/16/2023 - 10:26 ET]

    Hello Markg, After deeper investigation and speaking with engineering. You are seeing expected behavior. They shared a suggestion of the following to try to assist you. 

    "What they could do is: remove all old documents they want to replace with new ones import new documents (seems like they could use the import feature we have, no need to copy&paste anything, https://docs.stoplight.io/docs/platform/58bf119ddff88-work-with-files#import-file) now, in code view, manually re-assign all the IDs publish the changes"

    Hope this helps!

  • Stoplight's avatar
    Stoplight
    Community Manager

    markg (OP) [05/16/2023 - 14:42 ET]

    Hi , thank you for looking into this! My confusion is that "manually re-assign all the IDs" conflicts with what the documentation says:

    If you delete a file from Stoplight, and later re-import it, the imported file is assigned a new stable ID if one isn't found in its contents. You may do this if you are managing an OpenAPI file in another tool, for example. To ensure your stable IDs stay in sync, add the Stoplight stable ID to the file in your external system, so that when it's re-imported, it won't be assigned a new stable ID.

    https://docs.stoplight.io/docs/platform/hosted-docs/stoplight-urls#stable-id-guidelines I followed the first part of your instructions and:

    1. Went to the Files tab and deleted our existing OpenAPI file.
    2. Imported the updated OpenAPI file.

     

    However, when we do this, it is assigning new IDs instead of the stable IDs in the OpenAPI file, even though we have added the stable ID into the file in our external system as directed by the documentation. Assigning all the IDs manually is too much manual work – we will have about 50 objects that need to be updated multiple times a day. Is there another way to "replace" the OpenAPI file in the workflow that follows the workflow detailed in the documentation?