Skip to main content
Committed ⭐️⭐️
Nov 30, 2023 9:29 AM UTC
Solved

Download openapi spec in CI

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?

kelvin
kelvinAnswer
Expert ⭐️⭐️⭐️⭐️
Nov 30, 2023 1:43 PM UTC

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
Expert ⭐️⭐️⭐️⭐️
kelvinAnswer
Expert ⭐️⭐️⭐️⭐️
Nov 30, 2023 1:43 PM UTC

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) 😊

Committed ⭐️⭐️
Nov 30, 2023 2:48 PM UTC

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.