Skip to main content
Answer

Download openapi spec in CI

  • November 30, 2023
  • 2 replies
  • 65 views

Trying to download the openapi spec over at https://api-docs.cognite.com/20230101/ by using the URL in the “download” link fails with 404 when trying to use the URL with wget/curl and “ADD” in a dockerfile. It seems like the link is generated behind the scenes during pageload by javascript. Is there a way to download the openapi spec in scripts e.g for use in CI pipelines and similar?

Best answer by kelvin

Hello! As we are continuously updating our API, relying on the live spec will potentially break things without any obvious reason (we see that parsers of openapi spec are behaving in very different ways). You should rather download it once, check it in, and keep it as part of the controlled environment (i.e. in git) 😊

2 replies

kelvin
Seasoned Practitioner
  • Seasoned Practitioner
  • Answer
  • November 30, 2023

Hello! As we are continuously updating our API, relying on the live spec will potentially break things without any obvious reason (we see that parsers of openapi spec are behaving in very different ways). You should rather download it once, check it in, and keep it as part of the controlled environment (i.e. in git) 😊


  • Author
  • Active
  • November 30, 2023

That is what I am currently doing, but it would be nice to have a nightly job running verifying that the spec is still compatible.