Support OpenAPI 3.1.0
It looks like OpenAI is now publishing new specs at version 3.1.0, which use a lot of "const" and other things. This library will need updated to support the latest.
Here is the updated task with the new link:
defmodule Mix.Tasks.UpdateOpenaiDocs do
@moduledoc """
Updates OpenAI API documentation files
"""
use Mix.Task
@impl Mix.Task
@target_dir "lib/ex_openai/docs"
def run(_) do
File.mkdir_p!(@target_dir)
docs_url = "https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml"
System.cmd("curl", ["-L", docs_url, "-o", "#{@target_dir}/docs.yaml"])
end
end
Tests no longer pass against this new version.
Thanks for reporting! I started with a v2 rewrite that revamps the entire parser into smaller moduels to make changes like this easier but haven't finished yet - https://github.com/dvcrn/ex_openai/tree/v2-rewrite, https://github.com/dvcrn/ex_openai/blob/v2-rewrite/docs/parsingv2.md
It's mostly functional but still missing some handling of type parsing around the api client to use proper structs
The v2 is already using the new API path - https://github.com/dvcrn/ex_openai/blob/v2-rewrite/lib/mix/tasks/update_openai_docs.ex
Curious, why not use some existing OpenAPI parser like spex or apical?
Because I didn't know those existed 😄
Good point, I'll check if those make life easier