diff --git a/plugins/openapi/adapter/cloudflare.go b/plugins/openapi/adapter/cloudflare.go new file mode 100644 index 0000000..e30a1e6 --- /dev/null +++ b/plugins/openapi/adapter/cloudflare.go @@ -0,0 +1,92 @@ +package adapter + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/patch-it-dev/patch-it-plugins/core/fetch" + "github.com/patch-it-dev/patch-it-plugins/core/github" + "github.com/patch-it-dev/patch-it-plugins/core/plugin" +) + +// Variables, not constants, only so tests can point them at a local server. +var ( + cloudflareRepo = "cloudflare/api-schemas" + cloudflarePath = "openapi.json" + // cloudflareCommitsURL lists the commits that changed the spec, newest + // first; with per_page=1, the newest. + cloudflareCommitsURL = "https://api.github.com/repos/cloudflare/api-schemas/commits?path=openapi.json&per_page=1" + // cloudflareCommitURL is one commit, for its date. + cloudflareCommitURL = "https://api.github.com/repos/cloudflare/api-schemas/commits/%s" + // cloudflareSpecURLTemplate is the OpenAPI description of the whole + // Cloudflare API (api.cloudflare.com/client/v4) at one commit of + // cloudflare/api-schemas (BSD-3-Clause), the spec Cloudflare's SDKs and + // Terraform provider are generated from. A bot commits it as "Update + // schema: openapi.json" several times a day and the repo has no tags + // (checked 2026-11-21), so the commits are the versions. About 30 MB; + // openapi.yaml beside it is the same spec. + cloudflareSpecURLTemplate = "https://raw.githubusercontent.com/cloudflare/api-schemas/%s/openapi.json" +) + +// Cloudflare adapts the Cloudflare API's spec in cloudflare/api-schemas for +// the openapi plugin. A tag here is a commit SHA. +type Cloudflare struct{} + +var _ Adapter = Cloudflare{} + +func (Cloudflare) API() string { return "cloudflare/api-spec" } + +// LatestTag is the SHA of the newest commit that changed the spec. +func (Cloudflare) LatestTag(ctx context.Context) (string, error) { + sha, err := github.LatestCommit(ctx, github.Get, cloudflareCommitsURL) + if err != nil { + return "", fmt.Errorf("looking up cloudflare's latest spec commit: %w", err) + } + return sha, nil +} + +// Versions are the days the spec changed, each read at that day's last +// commit (Daily). +func (Cloudflare) Versions(ctx context.Context) ([]plugin.Version, error) { + return commits(ctx, cloudflareRepo, cloudflarePath) +} + +// Fetch downloads the spec at commit sha and moves the server's /client/v4 +// into the paths: see ServerBasePath. Version is the commit's date +// (YYYY-MM-DD): info.version is a fixed "4.0.0" (checked 2026-11-21). +func (Cloudflare) Fetch(ctx context.Context, sha string) (Spec, error) { + fullSHA, date, err := github.Commit(ctx, github.Get, fmt.Sprintf(cloudflareCommitURL, sha)) + if err != nil { + return Spec{}, fmt.Errorf("looking up cloudflare spec commit %s: %w", sha, err) + } + if fullSHA == "" { + return Spec{}, fmt.Errorf("github commit %s has no sha", sha) + } + url := fmt.Sprintf(cloudflareSpecURLTemplate, fullSHA) + body, err := fetch.Get(ctx, url, nil) // raw.githubusercontent.com needs no auth + if err != nil { + return Spec{}, fmt.Errorf("fetching cloudflare spec %s: %w", sha, err) + } + if !json.Valid(body) { + return Spec{}, fmt.Errorf("cloudflare spec %s is not valid json", sha) + } + // The one server is "https://api.cloudflare.com/client/v4" and the + // paths don't repeat it: moved, an operation is named by the path a + // caller sends. + content, err := ServerBasePath(body) + if err != nil { + return Spec{}, fmt.Errorf("cloudflare spec %s: %w", sha, err) + } + return Spec{Content: content, Version: date.UTC().Format("2006-01-02"), SourceURL: url}, nil +} + +// SourcePointer: see BasePathPointer. +func (Cloudflare) SourcePointer(content []byte) func(string) string { + return BasePathPointer(content) +} + +var ( + _ Reshaper = Cloudflare{} + _ Lister = Cloudflare{} +) diff --git a/plugins/openapi/adapter/mongodb.go b/plugins/openapi/adapter/mongodb.go new file mode 100644 index 0000000..586d261 --- /dev/null +++ b/plugins/openapi/adapter/mongodb.go @@ -0,0 +1,78 @@ +package adapter + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/patch-it-dev/patch-it-plugins/core/fetch" + "github.com/patch-it-dev/patch-it-plugins/core/github" + "github.com/patch-it-dev/patch-it-plugins/core/plugin" +) + +// Variables, not constants, only so tests can point them at a local server. +var ( + atlasRepo = "mongodb/openapi" + atlasPath = "openapi/v2.json" + // atlasCommitsURL lists the commits that changed the spec, newest first; + // with per_page=1, the newest. + atlasCommitsURL = "https://api.github.com/repos/mongodb/openapi/commits?path=openapi/v2.json&per_page=1" + // atlasCommitURL is one commit, for its date. + atlasCommitURL = "https://api.github.com/repos/mongodb/openapi/commits/%s" + // atlasSpecURLTemplate is the OpenAPI description of the MongoDB Atlas + // Administration API v2 at one commit of mongodb/openapi: every + // operation with every resource version it serves. MongoDB's release + // workflow commits it ("ci(prod): Release OpenAPI Spec") a few times a + // week, 768 commits from 2024-07-25 to 2026-11-19 (checked 2026-11-21); + // the repo's v0.0.N tags mark tooling releases, not the spec. + atlasSpecURLTemplate = "https://raw.githubusercontent.com/mongodb/openapi/%s/openapi/v2.json" +) + +// MongoDBAtlas adapts the Atlas Administration API's spec in mongodb/openapi +// for the openapi plugin. A tag here is a commit SHA. +type MongoDBAtlas struct{} + +var _ Adapter = MongoDBAtlas{} + +func (MongoDBAtlas) API() string { return "mongodb/atlas-admin-spec" } + +// LatestTag is the SHA of the newest commit that changed the spec. +func (MongoDBAtlas) LatestTag(ctx context.Context) (string, error) { + sha, err := github.LatestCommit(ctx, github.Get, atlasCommitsURL) + if err != nil { + return "", fmt.Errorf("looking up mongodb atlas's latest spec commit: %w", err) + } + return sha, nil +} + +// Versions are the days the spec changed, each read at that day's last +// commit (Daily). +func (MongoDBAtlas) Versions(ctx context.Context) ([]plugin.Version, error) { + return commits(ctx, atlasRepo, atlasPath) +} + +// Fetch downloads the spec at commit sha. Version is the commit's date +// (YYYY-MM-DD): info.version is a fixed "2.0", and the resource versions +// (application/vnd.atlas.2025-03-12+json) are per operation, several in one +// spec. The server is https://cloud.mongodb.com with no path: the paths are +// already what a caller sends (/api/atlas/v2/...). +func (MongoDBAtlas) Fetch(ctx context.Context, sha string) (Spec, error) { + fullSHA, date, err := github.Commit(ctx, github.Get, fmt.Sprintf(atlasCommitURL, sha)) + if err != nil { + return Spec{}, fmt.Errorf("looking up mongodb atlas spec commit %s: %w", sha, err) + } + if fullSHA == "" { + return Spec{}, fmt.Errorf("github commit %s has no sha", sha) + } + url := fmt.Sprintf(atlasSpecURLTemplate, fullSHA) + body, err := fetch.Get(ctx, url, nil) // raw.githubusercontent.com needs no auth + if err != nil { + return Spec{}, fmt.Errorf("fetching mongodb atlas spec %s: %w", sha, err) + } + if !json.Valid(body) { + return Spec{}, fmt.Errorf("mongodb atlas spec %s is not valid json", sha) + } + return Spec{Content: body, Version: date.UTC().Format("2006-01-02"), SourceURL: url}, nil +} + +var _ Lister = MongoDBAtlas{} diff --git a/plugins/openapi/adapter/openai.go b/plugins/openapi/adapter/openai.go new file mode 100644 index 0000000..0c42511 --- /dev/null +++ b/plugins/openapi/adapter/openai.go @@ -0,0 +1,102 @@ +package adapter + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/patch-it-dev/patch-it-plugins/core/fetch" + "github.com/patch-it-dev/patch-it-plugins/core/github" + "github.com/patch-it-dev/patch-it-plugins/core/plugin" + "gopkg.in/yaml.v3" +) + +// Variables, not constants, only so tests can point them at a local server. +var ( + openaiRepo = "openai/openai-openapi" + openaiPath = "openapi.yaml" + // openaiCommitsURL lists the commits that changed the spec, newest + // first; with per_page=1, the newest. + openaiCommitsURL = "https://api.github.com/repos/openai/openai-openapi/commits?path=openapi.yaml&per_page=1" + // openaiCommitURL is one commit, for its date. + openaiCommitURL = "https://api.github.com/repos/openai/openai-openapi/commits/%s" + // openaiSpecURLTemplate is the OpenAPI description of the OpenAI API at + // one commit of openai/openai-openapi (MIT), the spec OpenAI's own SDKs + // are generated from. The repo commits it several times a day (589 + // commits that changed openapi.yaml from 2022-01-19 to 2026-11-21, + // checked 2026-11-21) and tags it seldom (1.3.0, 2.0.0), so the commits + // are the versions. openapi.json beside it only exists from 2026-07-16: + // the YAML has the whole history. + openaiSpecURLTemplate = "https://raw.githubusercontent.com/openai/openai-openapi/%s/openapi.yaml" +) + +// OpenAI adapts the OpenAI API's spec in openai/openai-openapi for the +// openapi plugin. A tag here is a commit SHA. +type OpenAI struct{} + +var _ Adapter = OpenAI{} + +func (OpenAI) API() string { return "openai/api" } + +// LatestTag is the SHA of the newest commit that changed the spec. +func (OpenAI) LatestTag(ctx context.Context) (string, error) { + sha, err := github.LatestCommit(ctx, github.Get, openaiCommitsURL) + if err != nil { + return "", fmt.Errorf("looking up openai's latest spec commit: %w", err) + } + return sha, nil +} + +// Versions are the days the spec changed, each read at that day's last +// commit (Daily): several commits a day is the norm here, and a day is the +// version a caller can name. +func (OpenAI) Versions(ctx context.Context) ([]plugin.Version, error) { + return commits(ctx, openaiRepo, openaiPath) +} + +// Fetch downloads the spec at commit sha, converts it from YAML to JSON (what +// diff.Parse reads) and moves the server's /v1 into the paths: see +// ServerBasePath. Version is the commit's date (YYYY-MM-DD): info.version +// ("2.3.0") isn't bumped with each change, and the API has no dated versions +// of its own. +func (OpenAI) Fetch(ctx context.Context, sha string) (Spec, error) { + fullSHA, date, err := github.Commit(ctx, github.Get, fmt.Sprintf(openaiCommitURL, sha)) + if err != nil { + return Spec{}, fmt.Errorf("looking up openai spec commit %s: %w", sha, err) + } + if fullSHA == "" { + return Spec{}, fmt.Errorf("github commit %s has no sha", sha) + } + url := fmt.Sprintf(openaiSpecURLTemplate, fullSHA) + body, err := fetch.Get(ctx, url, nil) // raw.githubusercontent.com needs no auth + if err != nil { + return Spec{}, fmt.Errorf("fetching openai spec %s: %w", sha, err) + } + content, err := YAMLToJSON(body) + if err != nil { + return Spec{}, fmt.Errorf("openai spec %s: %w", sha, err) + } + // The server is "https://api.openai.com/v1" and the paths don't repeat + // /v1 (checked 2026-11-21): moved, an operation is named by the path a + // caller sends ("POST /v1/audio/translations"). + if content, err = ServerBasePath(content); err != nil { + return Spec{}, fmt.Errorf("openai spec %s: %w", sha, err) + } + return Spec{Content: content, Version: date.UTC().Format("2006-01-02"), SourceURL: url}, nil +} + +// SourcePointer: see BasePathPointer. +func (OpenAI) SourcePointer(content []byte) func(string) string { return BasePathPointer(content) } + +var _ Reshaper = OpenAI{} + +// YAMLToJSON converts a YAML spec to JSON: diff.Parse reads JSON only, and +// normalize quotes the node it cites re-serialized, never the original bytes, +// so nothing quoted changes. +func YAMLToJSON(body []byte) ([]byte, error) { + var doc any + if err := yaml.Unmarshal(body, &doc); err != nil { + return nil, fmt.Errorf("parsing yaml: %w", err) + } + return json.Marshal(doc) +} diff --git a/plugins/openapi/adapter/versions.go b/plugins/openapi/adapter/versions.go index dd2f0af..35d6c18 100644 --- a/plugins/openapi/adapter/versions.go +++ b/plugins/openapi/adapter/versions.go @@ -26,8 +26,14 @@ func releases(ctx context.Context, repo string, keep func(string) bool) ([]plugi return versions.GitHubReleases(ctx, github.Get, repo, keep) } +// commits are the days a file changed, each read at the day's last commit +// (Daily). func commits(ctx context.Context, repo, path string) ([]plugin.Version, error) { - return versions.GitHubCommits(ctx, github.Get, repo, path) + vs, err := versions.GitHubCommits(ctx, github.Get, repo, path) + if err != nil { + return nil, err + } + return Daily(vs), nil } // Versions are stripe/openapi's releases. @@ -233,9 +239,9 @@ func (a Algolia) Versions(ctx context.Context) ([]plugin.Version, error) { return out, nil } -// Versions are the commits on appwrite/specs' default branch that changed -// specs/, oldest first: the ID is the commit's date (Fetch's Version), the -// Ref its SHA, read at the newest minor's directory. +// Versions are the days appwrite/specs' default branch changed specs/, +// oldest first, each at the day's last commit (Daily): the ID is the date +// (Fetch's Version), the Ref the SHA, read at the newest minor's directory. func (a Appwrite) Versions(ctx context.Context) ([]plugin.Version, error) { cs, err := versions.GitHubPages[struct { SHA string `json:"sha"` @@ -258,7 +264,7 @@ func (a Appwrite) Versions(ctx context.Context) ([]plugin.Version, error) { out = append(out, plugin.Version{ID: at.Format(time.DateOnly), Released: at, Ref: c.SHA, URL: c.URL}) } slices.SortStableFunc(out, func(a, b plugin.Version) int { return a.Released.Compare(b.Released) }) - return out, nil + return Daily(out), nil } var ( @@ -269,3 +275,20 @@ var ( _ Lister = Algolia{} _ Lister = Appwrite{} ) + +// Daily keeps one version per day of vs (oldest first, IDs dates, as +// versions.GitHubCommits lists them): the day's last commit, so a spec +// committed several times a day has one version per day, each ID once. +func Daily(vs []plugin.Version) []plugin.Version { + var out []plugin.Version + for _, v := range vs { + if n := len(out); n > 0 && out[n-1].ID == v.ID { + out[n-1] = v + continue + } + out = append(out, v) + } + return out +} + +var _ Lister = OpenAI{} diff --git a/plugins/openapi/adapter/versions_test.go b/plugins/openapi/adapter/versions_test.go index 98f10e5..c6be6c3 100644 --- a/plugins/openapi/adapter/versions_test.go +++ b/plugins/openapi/adapter/versions_test.go @@ -151,19 +151,32 @@ func TestAlgoliaListsEveryReleaseTag(t *testing.T) { } } -// Every commit that changed specs/, oldest first, dated. +// Every day specs/ changed, oldest first, at the day's last commit: the 40 +// commits saved fall on 16 days, and a version ID (the date) is named once. func TestAppwriteListsEverySpecCommit(t *testing.T) { srv := recorded(t, map[string]string{"/repos/appwrite/specs/commits?path=specs&per_page=100&page=1": "appwrite-commits.json"}) vs, err := Appwrite{APIBase: srv.URL}.Versions(context.Background()) if err != nil { t.Fatal(err) } - if len(vs) != 40 { - t.Fatalf("%d versions, want 40", len(vs)) + if len(vs) != 16 { + t.Fatalf("%d versions, want 16", len(vs)) } for i := 1; i < len(vs); i++ { - if vs[i].Released.Before(vs[i-1].Released) || len(vs[i].Ref) != 40 { + if !vs[i].Released.After(vs[i-1].Released) || vs[i].ID == vs[i-1].ID || len(vs[i].Ref) != 40 { t.Errorf("%v after %v", vs[i], vs[i-1]) } } } + +// Daily keeps each day's last commit, in order. +func TestDailyKeepsEachDaysLastCommit(t *testing.T) { + in := []plugin.Version{{ID: "2026-10-27", Ref: "a"}, {ID: "2026-10-28", Ref: "b"}, {ID: "2026-10-28", Ref: "c"}, {ID: "2026-10-30", Ref: "d"}} + var got []string + for _, v := range Daily(in) { + got = append(got, v.ID+" "+v.Ref) + } + if want := "2026-10-27 a,2026-10-28 c,2026-10-30 d"; strings.Join(got, ",") != want { + t.Errorf("got %v, want %s", got, want) + } +} diff --git a/plugins/openapi/cloudflare.go b/plugins/openapi/cloudflare.go new file mode 100644 index 0000000..1a1a364 --- /dev/null +++ b/plugins/openapi/cloudflare.go @@ -0,0 +1,39 @@ +package openapi + +import ( + "regexp" + + "github.com/patch-it-dev/patch-it-plugins/core/diff" +) + +// cloudflareDiff is how Cloudflare's spec says what it says: +// +// - Most deprecations use the `deprecated` flag (329 operations in the spec +// of 2026-11-20), and a few only the summary, written as Vercel's are: "List +// datasets (deprecated)", "Deprecated: Retrieve legacy embed code HTML" +// (11 of them). Other summaries and descriptions that say "deprecated" +// are about a parameter or a model, not the operation, so the +// description isn't read. +// - Path parameters are renamed without the URL changing: +// /zones/{zone_identifier}/analytics/dashboard became +// /zones/{zone_id}/analytics/dashboard on 2026-10-30. Matching by path +// template keeps that from reading as a removal. +var cloudflareDiff = diff.Options{PathTemplates: true, QuoteDeprecatedOperation: true, DeprecatedSummary: cloudflareDeprecatedSummary} + +// cloudflareDeprecatedWords: a summary that starts "Deprecated:" or ends +// "(deprecated)". Not "deprecat" anywhere ("Omitting `datasetId` is +// deprecated" is about a parameter). +var cloudflareDeprecatedWords = regexp.MustCompile(`(?i)^deprecated:|\(deprecated\)\s*$`) + +func cloudflareDeprecatedSummary(summary string) bool { + return cloudflareDeprecatedWords.MatchString(summary) +} + +// cloudflareKeep keeps operation deprecations, and removals of operations the +// old spec had marked deprecated. Everything else is dropped: a bot commits +// the 30 MB spec several times a day, and an operation can leave it without +// leaving the API or without notice (between 2026-10-29 and 2026-10-30 POST +// /accounts/move and four GET /tenants/{tenant_id} operations left it, never +// marked deprecated: the drop test), while property changes in the +// generated schemas are mostly the generator's. +var cloudflareKeep = deprecationsOnly(cloudflareDiff) diff --git a/plugins/openapi/cloudflare_test.go b/plugins/openapi/cloudflare_test.go new file mode 100644 index 0000000..807619c --- /dev/null +++ b/plugins/openapi/cloudflare_test.go @@ -0,0 +1,102 @@ +package openapi + +import ( + "context" + "fmt" + "os" + "slices" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/core/event" + "github.com/patch-it-dev/patch-it-plugins/core/kit/kittest" + "github.com/patch-it-dev/patch-it-plugins/plugins/openapi/adapter" +) + +// cloudflareDays are the saved excerpts of cloudflare/api-schemas's +// openapi.json (testdata/README.md): day -> the day's last commit. +var cloudflareDays = map[string]string{ + "2026-10-29": "46a48d5eba1d8a839cd8cc5712d2b9368e21e654", + "2026-10-30": "319dc756af2a642b3122b4db7e3b79ac1fbec7d8", +} + +func cloudflareURL(day string) string { + return "https://raw.githubusercontent.com/cloudflare/api-schemas/" + cloudflareDays[day] + "/openapi.json" +} + +// fakeCloudflareAdapter serves the saved excerpts, cited by the real URL each +// was copied from and reshaped as adapter.Cloudflare.Fetch does. +type fakeCloudflareAdapter struct{} + +func (fakeCloudflareAdapter) API() string { return "cloudflare/api-spec" } + +func (fakeCloudflareAdapter) LatestTag(context.Context) (string, error) { return "2026-10-30", nil } + +func (fakeCloudflareAdapter) Fetch(_ context.Context, day string) (adapter.Spec, error) { + if _, ok := cloudflareDays[day]; !ok { + return adapter.Spec{}, fmt.Errorf("no saved copy for %s", day) + } + body, err := os.ReadFile("testdata/cloudflare-" + day + ".json") + if err != nil { + return adapter.Spec{}, err + } + content, err := adapter.ServerBasePath(body) + if err != nil { + return adapter.Spec{}, err + } + return adapter.Spec{Content: content, Version: day, SourceURL: cloudflareURL(day)}, nil +} + +func (fakeCloudflareAdapter) SourcePointer(content []byte) func(string) string { + return adapter.BasePathPointer(content) +} + +func TestCloudflareRegistersItself(t *testing.T) { + kittest.Registered(t, Plugin{Adapter: adapter.Cloudflare{}}) +} + +// cloudflarePair stores the 2026-10-29 -> 2026-10-30 pair: the three +// Registrar domains operations, marked deprecated, left the spec, as did POST +// /accounts/move and GET /tenants/{tenant_id}, never marked. +func cloudflarePair(t *testing.T) []event.Event { + t.Helper() + ctx := context.Background() + s := openStore(t) + p := Plugin{Adapter: fakeCloudflareAdapter{}, Diff: cloudflareDiff, Keep: cloudflareKeep} + if rejected, err := kittest.Pair(ctx, vercelEnv(s), s, p, "2026-10-29", "2026-10-30"); err != nil || rejected { + t.Fatalf("pair: rejected=%v err=%v", rejected, err) + } + return kittest.Stored(t, s) +} + +// The golden test: the removal of the deprecated Registrar domains +// operations, superseded by /registrar/registrations. +func TestCloudflareGolden(t *testing.T) { + events := cloudflarePair(t) + var ops []string + for _, e := range events { + ops = append(ops, e.Subject.Operation) + if e.ChangeType != event.ChangeTypeBreaking || e.Version != "2026-10-30" || e.PreviousVersion != "2026-10-29" || e.SourceURL != cloudflareURL("2026-10-29") { + t.Errorf("%s: %s %s<-%s cites %s", e.Subject.Operation, e.ChangeType, e.Version, e.PreviousVersion, e.SourceURL) + } + } + slices.Sort(ops) + want := []string{ + "GET /client/v4/accounts/{account_id}/registrar/domains", + "GET /client/v4/accounts/{account_id}/registrar/domains/{domain_name}", + "PUT /client/v4/accounts/{account_id}/registrar/domains/{domain_name}", + } + if !slices.Equal(ops, want) { + t.Errorf("operations %v, want %v", ops, want) + } + kittest.Golden(t, "testdata/golden/cloudflare-api-spec.json", events) +} + +// The pinned drop test: POST /accounts/move and GET /tenants/{tenant_id} left +// the same spec without ever being marked deprecated: no event names them. +func TestCloudflareDropsRemovalsThatWerentDeprecated(t *testing.T) { + for _, e := range cloudflarePair(t) { + if e.Subject.Operation == "POST /client/v4/accounts/move" || e.Subject.Operation == "GET /client/v4/tenants/{tenant_id}" { + t.Errorf("event for %s, never deprecated", e.Subject.Operation) + } + } +} diff --git a/plugins/openapi/mongodb.go b/plugins/openapi/mongodb.go new file mode 100644 index 0000000..70e1657 --- /dev/null +++ b/plugins/openapi/mongodb.go @@ -0,0 +1,24 @@ +package openapi + +import "github.com/patch-it-dev/patch-it-plugins/core/diff" + +// atlasDiff is how the Atlas Administration API's spec says what it says: +// +// - Deprecations use the `deprecated` flag (53 operations on 2026-11-19). +// Fourteen operations mention "deprecated" in their description without +// it, each about the deprecated invitation flow ("This resource cannot +// be used to view details about users invited via the deprecated +// Invite One MongoDB Cloud User to Join One Project endpoint"), not the +// operation itself, so the description isn't read. +// - Matching by path template keeps a renamed path parameter from reading +// as a removal. +var atlasDiff = diff.Options{PathTemplates: true, QuoteDeprecatedOperation: true} + +// atlasKeep keeps operation deprecations, and removals of operations the old +// spec had marked deprecated (the tenant backup operations, deprecated and +// then gone between 2025-10 and 2026-11). Everything else is dropped: +// operations that leave the spec unmarked (GET /rest/unauth/version on +// 2024-08-07: the drop test), and schema and property changes, which the +// API's own changelog (mongodb/atlas-admin-api, kind changelog) reports per +// resource version. +var atlasKeep = deprecationsOnly(atlasDiff) diff --git a/plugins/openapi/mongodb_test.go b/plugins/openapi/mongodb_test.go new file mode 100644 index 0000000..3314cea --- /dev/null +++ b/plugins/openapi/mongodb_test.go @@ -0,0 +1,93 @@ +package openapi + +import ( + "context" + "fmt" + "os" + "slices" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/core/event" + "github.com/patch-it-dev/patch-it-plugins/core/kit/kittest" + "github.com/patch-it-dev/patch-it-plugins/plugins/openapi/adapter" +) + +// atlasDays are the saved excerpts of mongodb/openapi's openapi/v2.json +// (testdata/README.md): day -> the day's last commit. +var atlasDays = map[string]string{ + "2024-07-25": "6ae1e79533409017d2c3251e645aae28aa54bd8b", + "2024-08-07": "96b0555285636db831afeb5a0e9b2dfddbfab2c6", + "2025-02-18": "f7b9298adb18b804230c8516cb533196538a8db9", + "2025-02-20": "28b2c6fc35a44b3272d7afbcaae380e1d28f0e45", +} + +func atlasURL(day string) string { + return "https://raw.githubusercontent.com/mongodb/openapi/" + atlasDays[day] + "/openapi/v2.json" +} + +// fakeAtlasAdapter serves the saved excerpts, cited by the real URL each was +// copied from, as adapter.MongoDBAtlas.Fetch does. +type fakeAtlasAdapter struct{} + +func (fakeAtlasAdapter) API() string { return "mongodb/atlas-admin-spec" } + +func (fakeAtlasAdapter) LatestTag(context.Context) (string, error) { return "2025-02-20", nil } + +func (fakeAtlasAdapter) Fetch(_ context.Context, day string) (adapter.Spec, error) { + if _, ok := atlasDays[day]; !ok { + return adapter.Spec{}, fmt.Errorf("no saved copy for %s", day) + } + body, err := os.ReadFile("testdata/mongodb-atlas-" + day + ".json") + if err != nil { + return adapter.Spec{}, err + } + return adapter.Spec{Content: body, Version: day, SourceURL: atlasURL(day)}, nil +} + +func atlasPlugin() Plugin { + return Plugin{Adapter: fakeAtlasAdapter{}, Diff: atlasDiff, Keep: atlasKeep} +} + +func TestMongoDBAtlasRegistersItself(t *testing.T) { + kittest.Registered(t, Plugin{Adapter: adapter.MongoDBAtlas{}}) +} + +// The golden test: on 2025-02-20 Atlas deprecated 14 user-management +// operations at once, for the move to per-organization and per-project user +// endpoints. Three are saved (POST /users, GET /users/{userId}, GET +// /users/byName/{userName}), with GET /orgs/{orgId}/users, unchanged. +func TestMongoDBAtlasGolden(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if rejected, err := kittest.Pair(ctx, vercelEnv(s), s, atlasPlugin(), "2025-02-18", "2025-02-20"); err != nil || rejected { + t.Fatalf("pair: rejected=%v err=%v", rejected, err) + } + events := kittest.Stored(t, s) + var ops []string + for _, e := range events { + ops = append(ops, e.Subject.Operation) + if e.ChangeType != event.ChangeTypeDeprecation || e.Version != "2025-02-20" || e.PreviousVersion != "2025-02-18" || e.SourceURL != atlasURL("2025-02-20") || !strings.Contains(e.SourceExcerpt, `"deprecated":true`) { + t.Errorf("%s: %s %s<-%s cites %s", e.Subject.Operation, e.ChangeType, e.Version, e.PreviousVersion, e.SourceURL) + } + } + slices.Sort(ops) + want := []string{"GET /api/atlas/v2/users/byName/{userName}", "GET /api/atlas/v2/users/{userId}", "POST /api/atlas/v2/users"} + if !slices.Equal(ops, want) { + t.Errorf("operations %v, want %v", ops, want) + } + kittest.Golden(t, "testdata/golden/mongodb-atlas-admin-spec.json", events) +} + +// The pinned drop test: GET /rest/unauth/version left the spec on 2024-08-07 +// without ever being marked deprecated. No event. +func TestMongoDBAtlasDropsRemovalsThatWerentDeprecated(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if _, err := kittest.Pair(ctx, vercelEnv(s), s, atlasPlugin(), "2024-07-25", "2024-08-07"); err != nil { + t.Fatal(err) + } + if events := kittest.Stored(t, s); len(events) != 0 { + t.Fatalf("stored %d events, want none", len(events)) + } +} diff --git a/plugins/openapi/openai.go b/plugins/openapi/openai.go new file mode 100644 index 0000000..6ece003 --- /dev/null +++ b/plugins/openapi/openai.go @@ -0,0 +1,24 @@ +package openapi + +import "github.com/patch-it-dev/patch-it-plugins/core/diff" + +// openaiDiff is how OpenAI's spec says what it says: +// +// - Deprecations use the `deprecated` flag: in the spec of 2026-11-21, 17 +// operations carry it and none is called deprecated only in its summary +// or description (one description mentions deprecated models, not the +// operation). A flagged operation's description says why and when ("The +// endpoint and model are deprecated and scheduled to shut down on +// February 26, 2027"), so the event quotes the whole operation. +// - Path parameters could be renamed without the URL changing; matching by +// path template keeps a rename from reading as a removal. +var openaiDiff = diff.Options{PathTemplates: true, QuoteDeprecatedOperation: true} + +// openaiKeep keeps operation deprecations, and removals of operations the old +// spec had marked deprecated. Everything else is dropped: the spec is +// committed several times a day, and most of what changes is the spec's own +// shape, not the API (enum lists rewritten as const, schemas regenerated), +// or work in progress pulled the day after it was added (the session +// spending-limit schemas, added on 2026-11-17 and gone on 2026-11-18: the +// drop test). New operations aren't something to fix either. +var openaiKeep = deprecationsOnly(openaiDiff) diff --git a/plugins/openapi/openai_test.go b/plugins/openapi/openai_test.go new file mode 100644 index 0000000..0d307f9 --- /dev/null +++ b/plugins/openapi/openai_test.go @@ -0,0 +1,116 @@ +package openapi + +import ( + "context" + "fmt" + "os" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/core/event" + "github.com/patch-it-dev/patch-it-plugins/core/kit/kittest" + "github.com/patch-it-dev/patch-it-plugins/plugins/openapi/adapter" +) + +// openaiDays are the saved excerpts of openai/openai-openapi's openapi.yaml +// (testdata/README.md): day -> the day's last commit, the one Daily reads. +var openaiDays = map[string]string{ + "2026-10-27": "54640e1ce5465c6f2e597ac4b030f9b92ba6d044", + "2026-10-28": "aa880040fa7b23c8a7e3618b5ca757ecec71de95", + "2026-11-17": "b2fe5a5d9eb3a580da5aed1d3ff2a03b3853e4f8", + "2026-11-18": "d4eae433ac22ac1b1f9af8ecfdbd529d6cea082e", +} + +func openaiURL(day string) string { + return "https://raw.githubusercontent.com/openai/openai-openapi/" + openaiDays[day] + "/openapi.yaml" +} + +// fakeOpenAIAdapter serves the saved excerpts, cited by the real URL each was +// copied from and converted and reshaped as adapter.OpenAI.Fetch does. +type fakeOpenAIAdapter struct{} + +func (fakeOpenAIAdapter) API() string { return "openai/api" } + +func (fakeOpenAIAdapter) LatestTag(context.Context) (string, error) { return "2026-11-18", nil } + +func (fakeOpenAIAdapter) Fetch(_ context.Context, day string) (adapter.Spec, error) { + if _, ok := openaiDays[day]; !ok { + return adapter.Spec{}, fmt.Errorf("no saved copy for %s", day) + } + body, err := os.ReadFile("testdata/openai-" + day + ".yaml") + if err != nil { + return adapter.Spec{}, err + } + content, err := adapter.YAMLToJSON(body) + if err != nil { + return adapter.Spec{}, err + } + if content, err = adapter.ServerBasePath(content); err != nil { + return adapter.Spec{}, err + } + return adapter.Spec{Content: content, Version: day, SourceURL: openaiURL(day)}, nil +} + +func (fakeOpenAIAdapter) SourcePointer(content []byte) func(string) string { + return adapter.BasePathPointer(content) +} + +func openaiPlugin() Plugin { + return Plugin{Adapter: fakeOpenAIAdapter{}, Diff: openaiDiff, Keep: openaiKeep} +} + +func TestOpenAIRegistersItself(t *testing.T) { + kittest.Registered(t, Plugin{Adapter: adapter.OpenAI{}}) +} + +// The golden test: on 2026-10-28 ("Mark /audio/translations endpoint as +// deprecated", ff80a233) POST /audio/translations gained the flag and "The +// endpoint and model are deprecated and scheduled to shut down on February +// 26, 2027". The same day added GET and POST /organization/external_keys +// (dropped: new) and left /audio/transcriptions as it was. +func TestOpenAIGolden(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if rejected, err := kittest.Pair(ctx, vercelEnv(s), s, openaiPlugin(), "2026-10-27", "2026-10-28"); err != nil || rejected { + t.Fatalf("pair: rejected=%v err=%v", rejected, err) + } + events := kittest.Stored(t, s) + if len(events) != 1 { + t.Fatalf("stored %d events, want 1", len(events)) + } + e := events[0] + if e.Subject.Operation != "POST /v1/audio/translations" || e.ChangeType != event.ChangeTypeDeprecation || e.Version != "2026-10-28" || e.PreviousVersion != "2026-10-27" { + t.Errorf("got %s %s %s (after %s)", e.ChangeType, e.Subject.Operation, e.Version, e.PreviousVersion) + } + if e.SourceURL != openaiURL("2026-10-28") || e.SourcePointer != "/paths/~1audio~1translations/post" { + t.Errorf("cites %s#%s", e.SourceURL, e.SourcePointer) + } + if !strings.Contains(e.SourceExcerpt, "scheduled to shut down on February 26, 2027") { + t.Errorf("excerpt lacks the shutdown date: %.300s", e.SourceExcerpt) + } + kittest.Golden(t, "testdata/golden/openai-api.json", events) +} + +// The pinned drop test: the session spending-limit schemas added on +// 2026-11-17 were gone on 2026-11-18 ("Remove session spending limit +// features"), never released as anything callers relied on. Three schema +// removals unfiltered, no event. +func TestOpenAIDropsWorkInProgressPulledBack(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if _, err := kittest.Pair(ctx, vercelEnv(s), s, openaiPlugin(), "2026-11-17", "2026-11-18"); err != nil { + t.Fatal(err) + } + if events := kittest.Stored(t, s); len(events) != 0 { + t.Fatalf("stored %d events, want none", len(events)) + } + s = openStore(t) + p := openaiPlugin() + p.Keep = nil + if _, err := kittest.Pair(ctx, vercelEnv(s), s, p, "2026-11-17", "2026-11-18"); err != nil { + t.Fatal(err) + } + if n := len(kittest.Stored(t, s)); n != 3 { + t.Errorf("unfiltered: %d events, want the 3 schema removals", n) + } +} diff --git a/plugins/openapi/openapi.go b/plugins/openapi/openapi.go index 9cb97ef..eab4a15 100644 --- a/plugins/openapi/openapi.go +++ b/plugins/openapi/openapi.go @@ -1,10 +1,8 @@ -// Package openapi is the source plugin for an API that publishes an OpenAPI -// spec per release (Stripe, Datadog, GitLab, GitHub, Vercel, Supabase, -// Algolia, Elasticsearch, Sentry, Neon, Convex, PlanetScale, Appwrite): fetch -// the newest spec, diff it against the last one seen, normalize the changes -// into events, and attach migration hints from the API's changelog when it -// has one. Every release is listed and each consecutive pair diffed -// (ListVersions, ReadAt, Extract). +// Package openapi is the kind for an API that publishes an OpenAPI spec per +// release (a tag, a release, or the commits that changed the spec): every +// release is listed, each consecutive pair diffed (ListVersions, ReadAt, +// Extract), the changes normalized into events, and migration hints +// attached from the API's changelog when it has one. package openapi import ( @@ -188,6 +186,43 @@ func init() { Plugin: Plugin{Adapter: adapter.Flagsmith{}, Keep: requestSide}, }}, }) + // No Hints: OpenAI's changelog is product news, not keyed by operation. + // Only operation deprecations and removals: see openai.go. + plugin.RegisterProvider(plugin.Provider{ + ID: "openai", Name: "OpenAI", Category: plugin.CategoryAI, Homepage: "https://openai.com", + Sources: []plugin.Source{{ + ID: "api", Layer: plugin.LayerAPI, Page: "providers/openai-api.md", + Watches: "REST API operations deprecated, and deprecated operations removed, day by day in the spec OpenAI's SDKs are generated from", + URLs: []string{"https://github.com/openai/openai-openapi/blob/main/openapi.yaml"}, + Packages: []string{"pypi:openai", "npm:openai"}, + Plugin: Plugin{Adapter: adapter.OpenAI{}, Diff: openaiDiff, Keep: openaiKeep}, + }}, + }) + // No Hints: Cloudflare's changelog is product news, not keyed by + // operation. Only operation deprecations and removals: see cloudflare.go. + // (cloudflare/api is the deprecations feed, registered by plugins/notices.) + plugin.RegisterProvider(plugin.Provider{ + ID: "cloudflare", Name: "Cloudflare", Category: plugin.CategoryInfrastructure, Homepage: "https://www.cloudflare.com", + Sources: []plugin.Source{{ + ID: "api-spec", Layer: plugin.LayerAPI, Page: "providers/cloudflare-api-spec.md", + Watches: "API operations deprecated, and deprecated operations removed, day by day in the spec Cloudflare's SDKs and Terraform provider are generated from", + URLs: []string{"https://github.com/cloudflare/api-schemas/blob/main/openapi.json"}, + Packages: []string{"pypi:cloudflare", "npm:cloudflare"}, + Plugin: Plugin{Adapter: adapter.Cloudflare{}, Diff: cloudflareDiff, Keep: cloudflareKeep}, + }}, + }) + // No Hints: the Atlas changelog is its own source (mongodb/atlas-admin-api, + // kind changelog). Only operation deprecations and removals: see + // mongodb.go. + plugin.RegisterProvider(plugin.Provider{ + ID: "mongodb", Name: "MongoDB", Category: plugin.CategoryDatabases, Homepage: "https://www.mongodb.com", + Sources: []plugin.Source{{ + ID: "atlas-admin-spec", Layer: plugin.LayerAPI, Page: "providers/mongodb-atlas-admin-spec.md", + Watches: "Atlas Administration API v2 operations deprecated, and deprecated operations removed, day by day in MongoDB's published spec", + URLs: []string{"https://github.com/mongodb/openapi/blob/main/openapi/v2.json"}, + Plugin: Plugin{Adapter: adapter.MongoDBAtlas{}, Diff: atlasDiff, Keep: atlasKeep}, + }}, + }) } // requestSide keeps the changes to what callers send. GitLab's response diff --git a/plugins/openapi/registered_test.go b/plugins/openapi/registered_test.go index 489b0c1..f4f07f5 100644 --- a/plugins/openapi/registered_test.go +++ b/plugins/openapi/registered_test.go @@ -8,7 +8,7 @@ import ( ) func TestRegistersItself(t *testing.T) { - for _, a := range []adapter.Adapter{adapter.Stripe{}, adapter.Datadog{}, adapter.GitLab{}, adapter.GitHub{}, adapter.Vercel{}, adapter.Supabase{}, adapter.Algolia{Spec: "search"}, adapter.Algolia{Spec: "ingestion"}, adapter.Algolia{Spec: "recommend"}, adapter.Elasticsearch{}, adapter.Sentry{}, adapter.Neon{}, adapter.Convex{}, adapter.PlanetScale{}, adapter.Appwrite{}} { + for _, a := range []adapter.Adapter{adapter.Stripe{}, adapter.Datadog{}, adapter.GitLab{}, adapter.GitHub{}, adapter.Vercel{}, adapter.Supabase{}, adapter.Algolia{Spec: "search"}, adapter.Algolia{Spec: "ingestion"}, adapter.Algolia{Spec: "recommend"}, adapter.Elasticsearch{}, adapter.Sentry{}, adapter.Neon{}, adapter.Convex{}, adapter.PlanetScale{}, adapter.Appwrite{}, adapter.OpenAI{}, adapter.Cloudflare{}, adapter.MongoDBAtlas{}} { kittest.Registered(t, Plugin{Adapter: a}) } } diff --git a/plugins/openapi/testdata/README.md b/plugins/openapi/testdata/README.md index 2e5210d..3e88f5e 100644 --- a/plugins/openapi/testdata/README.md +++ b/plugins/openapi/testdata/README.md @@ -58,3 +58,8 @@ The Appwrite copies keep `openapi`, `info`, `servers` and the path items involve Stripe's spec isn't saved here: its tests use small specs written inline. The Flagsmith copies are trimmed by lines: `openapi`, `info` and `servers`, then the path items involved (`paths: {}` where none remain, the one line in `v2.287.0.yaml` that isn't in the original) and, under `components: schemas:`, every schema those paths' request bodies reach, transitively, whole and in original order, every line copied unchanged; `tags` and `security` left out. `FeatureValue`, `FeatureValueTypeEnum` and `MultivariateValue` are kept unchanged in both files because the real spec still has them at `v2.287.0` (other, unremoved operations use them too); every other schema the removed paths reached (`DeleteSegmentOverride`, `EnvironmentDefault`, `FeatureIdentifier`, `FeatureUpdateSegmentData`, `SegmentIdentifier`, `SegmentOverride`, `UpdateFlag`, `UpdateFlagV2`) really is gone in `v2.287.0`, confirmed against the full file. The drop-test pair is two commits, not tags, kept whole but for the same trim (`TokenExchangeResponse` and the `Master API Key` security scheme, the only two places that commit touched `openapi.yaml`). +| `openai-2026-10-27.yaml`, `openai-2026-10-28.yaml` | https://raw.githubusercontent.com/openai/openai-openapi/54640e1ce5465c6f2e597ac4b030f9b92ba6d044/openapi.yaml (and `aa880040fa7b23c8a7e3618b5ca757ecec71de95`), the last commits of 2026-10-27 and 2026-10-28; trimmed to `info`, `servers` and the paths `/audio/translations`, `/audio/transcriptions` (and `/organization/external_keys`, new on 2026-10-28) | 2026-11-21 | MIT (openai/openai-openapi) | "The endpoint and model are deprecated and scheduled to shut down on February 26, 2027." (`POST /audio/translations`, flagged on 2026-10-28) | +| `openai-2026-11-17.yaml`, `openai-2026-11-18.yaml` | https://raw.githubusercontent.com/openai/openai-openapi/b2fe5a5d9eb3a580da5aed1d3ff2a03b3853e4f8/openapi.yaml (and `d4eae433ac22ac1b1f9af8ecfdbd529d6cea082e`); trimmed to `info`, `servers` and the schemas `SessionBudgetControlParams`, `SessionBudgetControlResource`, `SessionEventAgentSessionBudgetReached` | 2026-11-21 | MIT (openai/openai-openapi) | `SessionBudgetControlParams:` (in 2026-11-17, gone in 2026-11-18, "Remove session spending limit features"): the drop test | +| `cloudflare-2026-10-29.json`, `cloudflare-2026-10-30.json` | https://raw.githubusercontent.com/cloudflare/api-schemas/46a48d5eba1d8a839cd8cc5712d2b9368e21e654/openapi.json (and `319dc756af2a642b3122b4db7e3b79ac1fbec7d8`), the last commits of 2026-10-29 and 2026-10-30; trimmed to `openapi`, `info`, `servers` and five paths, re-indented as published (2 spaces) | 2026-11-21 | BSD-3-Clause (cloudflare/api-schemas) | "This operation is deprecated and will reach end of life on September 27, 2026." (`GET /accounts/{account_id}/registrar/domains`, in 2026-10-29, gone in 2026-10-30) | +| `mongodb-atlas-2025-02-18.json`, `mongodb-atlas-2025-02-20.json` | https://raw.githubusercontent.com/mongodb/openapi/f7b9298adb18b804230c8516cb533196538a8db9/openapi/v2.json (and `28b2c6fc35a44b3272d7afbcaae380e1d28f0e45`), the last commits of 2025-02-18 and 2025-02-20; trimmed to `openapi`, `info`, `servers` and four `/api/atlas/v2/users` and `/orgs/{orgId}/users` paths | 2026-11-21 | Excerpt for testing; © MongoDB, CC BY-NC-SA 3.0 US (the spec's `info.license`) | `"deprecated": true` (`GET /api/atlas/v2/users/byName/{userName}`, new in 2025-02-20) | +| `mongodb-atlas-2024-07-25.json`, `mongodb-atlas-2024-08-07.json` | https://raw.githubusercontent.com/mongodb/openapi/6ae1e79533409017d2c3251e645aae28aa54bd8b/openapi/v2.json (and `96b0555285636db831afeb5a0e9b2dfddbfab2c6`); trimmed to `openapi`, `info`, `servers` and the paths `/rest/unauth/version`, `/api/atlas/v2` | 2026-11-21 | Excerpt for testing; © MongoDB, CC BY-NC-SA 3.0 US | `"/rest/unauth/version": {` (in 2024-07-25, gone in 2024-08-07, never deprecated): the drop test | diff --git a/plugins/openapi/testdata/cloudflare-2026-10-29.json b/plugins/openapi/testdata/cloudflare-2026-10-29.json new file mode 100644 index 0000000..f26670f --- /dev/null +++ b/plugins/openapi/testdata/cloudflare-2026-10-29.json @@ -0,0 +1,1200 @@ +{ + "openapi": "3.0.3", + "info": { + "description": "Welcome to Cloudflare's API documentation site. We are experimenting with an updated version of our API documentation - check out [developers.cloudflare.com/api-next/](https://developers.cloudflare.com/api-next/) to test out the new experience.\n\nTo get started using Cloudflare's products and services via the API, refer to [how to interact with Cloudflare](https://developers.cloudflare.com/fundamentals/basic-tasks/interact-with-cloudflare/), which covers using tools like [Terraform](https://developers.cloudflare.com/terraform/#cloudflare-terraform) and the [official SDKs](https://developers.cloudflare.com/fundamentals/api/reference/sdks/) to maintain your Cloudflare resources.\n\nUsing the Cloudflare API requires authentication so that Cloudflare knows who is making requests and what permissions you have. Create an API token to grant access to the API to perform actions. You can also authenticate with [API keys](https://developers.cloudflare.com/fundamentals/api/get-started/keys/), but these keys have [several limitations](https://developers.cloudflare.com/fundamentals/api/get-started/keys/#limitations) that make them less secure than API tokens. Whenever possible, use API tokens to interact with the Cloudflare API.\n\nTo create an API token, from the Cloudflare dashboard, go to My Profile > API Tokens and select Create Token. For more information on how to create and troubleshoot API tokens, refer to\nour [API fundamentals](https://developers.cloudflare.com/fundamentals/api/).\n\nFor information regarding rate limits, refer to our [API Rate Limits](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/platform/limits/#api-rate-limits).\n\nTotally new to Cloudflare? [Start here](https://developers.cloudflare.com/fundamentals/get-started/).", + "license": { + "name": "BSD-3-Clause", + "url": "https://opensource.org/licenses/BSD-3-Clause" + }, + "title": "Cloudflare API", + "version": "4.0.0" + }, + "servers": [ + { + "description": "Client API", + "url": "https://api.cloudflare.com/client/v4" + } + ], + "paths": { + "/accounts/move": { + "post": { + "operationId": "Accounts_batchMoveAccounts", + "summary": "Batch move accounts", + "description": "Batch move a collection of accounts to a specific organization. ⚠️ Not implemented.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "account_ids": { + "description": "Move these accounts to the destination organization.", + "type": "array", + "items": { + "type": "string" + } + }, + "destination_organization_id": { + "description": "Move accounts to this organization ID.", + "type": "string" + } + }, + "required": [ + "account_ids", + "destination_organization_id" + ] + } + } + } + }, + "responses": { + "200": { + "description": "The request has succeeded.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object" + }, + "maxItems": 0 + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/organizations-api_V4Message" + } + }, + "result": { + "$ref": "#/components/schemas/organizations-api_BatchAccountMoveResponse" + }, + "success": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "success", + "errors", + "messages", + "result" + ] + } + } + } + }, + "4XX": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/organizations-api_V4ErrorResponse" + } + } + } + } + }, + "security": [ + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Accounts" + ], + "x-fern-availability": "alpha", + "x-fern-ignore": true, + "x-fern-sdk-group-name": "accounts.batch", + "x-fern-sdk-method-name": "move" + } + }, + "/accounts/{account_id}/registrar/domains": { + "get": { + "operationId": "registrar-domains-list-domains", + "summary": "List domains", + "description": "Lists domains handled by Registrar.", + "parameters": [ + { + "name": "account_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + } + ], + "responses": { + "200": { + "description": "List domains response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_response_collection" + } + } + } + }, + "4XX": { + "description": "List domains response failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "deprecated": true, + "security": [ + { + "api_email": [], + "api_key": [], + "api_token": [] + } + ], + "tags": [ + "Registrar Domains" + ], + "x-api-token-group": null, + "x-fern-ignore": true, + "x-fern-sdk-group-name": "registrar.legacy", + "x-fern-sdk-method-name": "list-domains", + "x-stainless-deprecation-message": "This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details." + } + }, + "/accounts/{account_id}/registrar/domains/{domain_name}": { + "get": { + "operationId": "registrar-domains-get-domain", + "summary": "Get domain", + "description": "Show individual domain.", + "parameters": [ + { + "name": "domain_name", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_name" + } + }, + { + "name": "account_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + } + ], + "responses": { + "200": { + "description": "Get domain response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_response_single" + } + } + } + }, + "4XX": { + "description": "Get domain response failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "deprecated": true, + "security": [ + { + "api_email": [], + "api_key": [], + "api_token": [] + } + ], + "tags": [ + "Registrar Domains" + ], + "x-api-token-group": null, + "x-fern-ignore": true, + "x-fern-sdk-group-name": "registrar.legacy", + "x-fern-sdk-method-name": "get-domain", + "x-stainless-deprecation-message": "This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details." + }, + "put": { + "operationId": "registrar-domains-update-domain", + "summary": "Update domain", + "description": "Updates an individual domain.", + "parameters": [ + { + "name": "domain_name", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_name" + } + }, + { + "name": "account_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_update_properties" + } + } + } + }, + "responses": { + "200": { + "description": "Update domain response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_domain_response_single" + } + } + } + }, + "4XX": { + "description": "Update domain response failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "deprecated": true, + "security": [ + { + "api_email": [], + "api_key": [], + "api_token": [] + } + ], + "tags": [ + "Registrar Domains" + ], + "x-api-token-group": null, + "x-fern-ignore": true, + "x-fern-sdk-group-name": "registrar.legacy", + "x-fern-sdk-method-name": "update-domain", + "x-stainless-deprecation-message": "This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details." + } + }, + "/accounts/{account_id}/registrar/registrations": { + "get": { + "operationId": "registrar-domain-registration-list", + "summary": "List Registrations", + "description": "Returns a paginated list of domain registrations owned by the account.\n\nThis endpoint uses cursor-based pagination. Results are ordered by registration\ndate by default. To fetch the next page, pass the `cursor` value from the\n`result_info` object in the response as the `cursor` query parameter in\nyour next request. An empty `cursor` string indicates there are no more\npages.\n", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "Cloudflare account ID.", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_cursor" + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_per_page" + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_direction" + }, + { + "name": "sort_by", + "in": "query", + "description": "Column to sort results by. Defaults to registration date (`registry_created_at`) when omitted.", + "schema": { + "type": "string", + "default": "registry_created_at", + "enum": [ + "registry_created_at", + "registry_expires_at", + "name" + ] + } + } + ], + "responses": { + "200": { + "description": "List of registrations for the account.", + "content": { + "application/json": { + "examples": { + "empty_account": { + "summary": "Account with no registrations", + "value": { + "errors": [], + "messages": [], + "result": [], + "result_info": { + "count": 0, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "multiple_domains": { + "summary": "Account with multiple domains", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2025-01-15T10:00:00Z", + "domain_name": "example.com", + "expires_at": "2026-01-15T10:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2025-03-20T14:30:00Z", + "domain_name": "mybrand.dev", + "expires_at": "2026-03-20T14:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 2, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "next_page": { + "description": "Response when fetching the next page by passing the cursor from a previous response. The empty cursor indicates this is the last page.", + "summary": "Next page of results (last page)", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2025-04-01T09:00:00Z", + "domain_name": "charlie.org", + "expires_at": "2026-04-01T09:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 1, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "paginated": { + "summary": "First page with more results available", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2024-01-15T09:30:00Z", + "domain_name": "acmecorp.com", + "expires_at": "2026-01-15T09:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-02-20T14:00:00Z", + "domain_name": "brightwave.net", + "expires_at": "2026-02-20T14:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-03-05T11:15:00Z", + "domain_name": "cloudpeak.org", + "expires_at": "2026-03-05T11:15:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-03-22T08:45:00Z", + "domain_name": "solarpanel.io", + "expires_at": "2026-03-22T08:45:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-04-10T16:00:00Z", + "domain_name": "greenleaf.dev", + "expires_at": "2026-04-10T16:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-05-03T10:30:00Z", + "domain_name": "swiftrunner.app", + "expires_at": "2026-05-03T10:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-05-18T13:00:00Z", + "domain_name": "northerntrail.co", + "expires_at": "2025-05-18T13:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "expired" + }, + { + "auto_renew": true, + "created_at": "2024-06-01T07:20:00Z", + "domain_name": "pixelforge.xyz", + "expires_at": "2026-06-01T07:20:00Z", + "locked": false, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-06-25T15:45:00Z", + "domain_name": "oceandrift.com", + "expires_at": "2026-06-25T15:45:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-07-12T09:00:00Z", + "domain_name": "rocketlaunch.net", + "expires_at": "2026-07-12T09:00:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-08-08T12:30:00Z", + "domain_name": "blueprintlab.io", + "expires_at": "2026-08-08T12:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-09-01T18:00:00Z", + "domain_name": "maplewood.org", + "expires_at": "2026-09-01T18:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-09-20T10:15:00Z", + "domain_name": "thunderbolt.dev", + "expires_at": "2025-09-20T10:15:00Z", + "locked": false, + "privacy_mode": "off", + "status": "expired" + }, + { + "auto_renew": true, + "created_at": "2024-10-05T14:45:00Z", + "domain_name": "silverbranch.app", + "expires_at": "2026-10-05T14:45:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-11-11T08:00:00Z", + "domain_name": "nightowl.co", + "expires_at": "2026-11-11T08:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-12-01T11:30:00Z", + "domain_name": "crimsongate.com", + "expires_at": "2026-12-01T11:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2025-01-07T16:20:00Z", + "domain_name": "frostedpine.net", + "expires_at": "2027-01-07T16:20:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-01-25T09:50:00Z", + "domain_name": "horizonline.xyz", + "expires_at": "2027-01-25T09:50:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-02-14T13:00:00Z", + "domain_name": "coppervine.io", + "expires_at": "2027-02-14T13:00:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-03-02T07:40:00Z", + "domain_name": "starlitpath.org", + "expires_at": "2027-03-02T07:40:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 20, + "cursor": "eyJ0IjoiMjAyNS0wNi0xNVQxMjowMDowMC4wMDAwMDBaIiwibiI6ImJyYXZvLm5ldCJ9", + "per_page": 20 + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_registration-response-collection" + } + } + } + }, + "4XX": { + "description": "List registrations failure.", + "content": { + "application/json": { + "examples": { + "invalid_cursor": { + "summary": "Invalid cursor", + "value": { + "errors": [ + { + "code": 10000, + "message": "Invalid pagination cursor" + } + ], + "messages": [], + "result": null, + "success": false + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "security": [ + { + "api_token": [] + }, + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Registrar Registration" + ], + "x-fern-availability": "generally-available", + "x-fern-sdk-group-name": "registrar.registrations", + "x-fern-sdk-method-name": "list" + }, + "post": { + "operationId": "registrar-domain-registration-create", + "summary": "Create Registration", + "description": "Starts a domain registration workflow. This is a billable operation — successful\nregistration charges the account's default payment method. All successful\ndomain registrations are non-refundable — once the workflow completes with\n`state: succeeded`, the charge cannot be reversed.\n\n### Prerequisites\n- The account must have a billing profile with a valid default payment method.\n Set this up at `https://dash.cloudflare.com/{account_id}/billing/payment-info`.\n- The account must not already be at the maximum supported domain limit.\n A single account may own up to 500 domains in total across registrations\n created through either the dashboard or this API.\n- The domain must be on a supported extension for programmatic registration.\n- Use `POST /domain-check` immediately before calling this endpoint to confirm\n real-time availability and pricing.\n\n### Supported extensions\n\nThis API supports programmatic registration for all extensions supported by\nthe dashboard experience, with the following exceptions:\n\n`giving`, `mom`, `inc`, `lol`, `sh`, `link`, `cc`, `new`\n\nCloudflare Registrar supports 400+ extensions in the dashboard. Extensions\nlisted above can be registered at\n`https://dash.cloudflare.com/{account_id}/domains/registrations`.\n\n### Express mode\nThe only required field is `domain_name`. If `contacts` is omitted, the system\nuses the account's default address book entry as the registrant. If no default\nexists and no contact is provided, the request fails. Set up a default address\nbook entry and accept the required agreement at\n`https://dash.cloudflare.com/{account_id}/domains/registrations`.\n\n### Defaults\n- `years`: defaults to the extension's minimum registration period (1 year for\n most extensions, but varies — for example, `.ai` (if supported) requires a minimum of 2 years).\n- `auto_renew`: defaults to `false`. Setting it to `true` is an explicit\n opt-in authorizing Cloudflare to charge the account's default payment\n method up to 30 days before domain expiry to renew the registration.\n Renewal pricing may change over time based on registry pricing.\n- `privacy_mode`: defaults to `redaction`.\n\n### Premium domains\nPremium domain registration is not currently supported by this API.\nIf `POST /domain-check` returns `tier: premium`, do not call this\nendpoint for that domain.\n\n### Response behavior\nBy default, the server holds the connection for a bounded, server-defined\namount of time while the registration completes. Most registrations finish\nwithin this window and return `201 Created` with a completed workflow status.\n\nIf the registration is still processing after this synchronous wait window,\nthe server returns `202 Accepted`. Poll the URL in `links.self` to track progress.\n\nTo skip the wait and receive an immediate `202`, send `Prefer: respond-async`.\n", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "Cloudflare account ID. Required for all Registrar API operations.", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + }, + { + "name": "Prefer", + "in": "header", + "description": "Set to `respond-async` to receive an immediate `202 Accepted` without\nwaiting for the operation to complete (RFC 7240).\n\nThe header may be combined with other preferences using standard\ncomma-separated syntax.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "examples": { + "ca_with_contact_extensions": { + "description": "CA registrations require a registrant legal type.\nProvide the required value in `contact_extensions` as described\nby the live .ca registration schema.\n", + "summary": "Register a .ca domain with legal type", + "value": { + "auto_renew": false, + "contact_extensions": { + "ca_legal_type": "CCT" + }, + "contacts": { + "registrant": { + "email": "ada@example.ca", + "phone": "+1.6135550100", + "postal_info": { + "address": { + "city": "Ottawa", + "country_code": "CA", + "postal_code": "K1A 0B1", + "state": true, + "street": "123 Queen St" + }, + "name": "Ada Lovelace", + "organization": "Example Canada Inc" + } + } + }, + "domain_name": "my-brand-example.ca", + "years": 1 + } + }, + "io_with_role_contacts": { + "description": "Some extension schemas accept additional standard contact roles such as `technical`, `administrator`, and `billing`. When these roles are provided explicitly, Cloudflare preserves the supplied role-specific contact data instead of deriving it from `contacts.registrant`.", + "summary": "Register with explicit role contacts", + "value": { + "auto_renew": false, + "contacts": { + "administrator": { + "email": "katherine@example.io", + "phone": "+1.5555550102", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94103", + "state": "CA", + "street": "789 Mission St" + }, + "name": "Katherine Johnson", + "organization": "Example Admin Inc" + } + }, + "billing": { + "email": "dorothy@example.io", + "phone": "+1.5555550103", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94105", + "state": "CA", + "street": "101 Howard St" + }, + "name": "Dorothy Vaughan", + "organization": "Example Billing Inc" + } + }, + "registrant": { + "email": "ada@example.io", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + }, + "technical": { + "email": "grace@example.io", + "phone": "+1.5555550101", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94105", + "state": "CA", + "street": "456 Market St" + }, + "name": "Grace Hopper", + "organization": "Example Technical Inc" + } + } + }, + "domain_name": "my-brand-example.io", + "years": 1 + } + }, + "minimal": { + "description": "The simplest registration request uses the following defaults.\n- `years` defaults to the extension's minimum registration period (typically 1 year).\n- `auto_renew` defaults to `false`.\n- `privacy_mode` defaults to `redaction`.\n- Registrant contact falls back to the account's default address book entry.\n", + "summary": "Minimal registration — just a domain name", + "value": { + "domain_name": "my-new-startup.com" + } + }, + "multi_year": { + "description": "Register a domain for 3 years.", + "summary": "Register for multiple years", + "value": { + "domain_name": "longterm-project.dev", + "years": 3 + } + }, + "uk_with_contact_extensions": { + "description": ".uk registrations can require registrant type information. For\norganization registrants, include the company number when the\nlive registration schema requires it.\n", + "summary": "Register a .uk domain with registrant type", + "value": { + "auto_renew": false, + "contact_extensions": { + "company_number": "12345678", + "registrant_type": "LTD" + }, + "contacts": { + "registrant": { + "email": "ada@example.co.uk", + "phone": "+44.2071234567", + "postal_info": { + "address": { + "city": "London", + "country_code": "GB", + "postal_code": "SW1A 1AA", + "state": "London", + "street": "1 Example Street" + }, + "name": "Ada Lovelace", + "organization": "Example UK Ltd" + } + } + }, + "domain_name": "my-brand-example.uk", + "years": 1 + } + }, + "us_with_contact_extensions": { + "description": "Some extensions require registry-specific contact extension\nvalues in addition to the standard registrant contact. The\nextension discovery endpoint is authoritative for the required\nkeys and allowed values.\n", + "summary": "Register a .us domain with contact extensions", + "value": { + "auto_renew": false, + "contact_extensions": { + "application_purpose": "P3", + "nexus_category": "C11" + }, + "contacts": { + "registrant": { + "email": "ada@example.com", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + } + }, + "domain_name": "my-brand-example.us", + "years": 1 + } + }, + "with_contact": { + "description": "Provide registrant contact data inline if the account does not have\na default address book entry, or to override it for this registration.\n`postal_info.name` is the complete contact name in one field.\nSome registries require a complete personal name, including a\nfamily or last name where applicable, but this API does not\naccept separate first-name and last-name fields.\n", + "summary": "Register with explicit registrant contact", + "value": { + "auto_renew": true, + "contacts": { + "registrant": { + "email": "ada@example.com", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + } + }, + "domain_name": "example.com", + "years": 1 + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_registration_create_request" + } + } + } + }, + "responses": { + "201": { + "description": "Registration completed successfully within the synchronous wait window.\nThe workflow status will have `state: succeeded` and `completed: true`.\n", + "headers": { + "Preference-Applied": { + "description": "Echoed when the server honored a `Prefer` header.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "examples": { + "completed": { + "summary": "Registration completed within timeout (most common)", + "value": { + "errors": [], + "messages": [], + "result": { + "completed": true, + "context": { + "domain_name": "example.com", + "registration": { + "auto_renew": true, + "created_at": "2025-10-27T10:00:00Z", + "domain_name": "example.com", + "expires_at": "2026-10-27T10:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + }, + "created_at": "2025-10-27T10:00:00Z", + "links": { + "resource": "/accounts/abc/registrar/registrations/example.com", + "self": "/accounts/abc/registrar/registrations/example.com/registration-status" + }, + "state": "succeeded", + "updated_at": "2025-10-27T10:00:03Z" + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_workflow-status-response-single" + } + } + } + }, + "202": { + "description": "Registration is still processing. This occurs when the operation did\nnot complete within the synchronous wait window, or when `Prefer: respond-async`\nwas sent. Poll the URL in `links.self` to track progress.\n", + "headers": { + "Location": { + "description": "URL of the workflow status resource (same as `links.self`).", + "schema": { + "type": "string" + } + }, + "Preference-Applied": { + "description": "Set to `respond-async` when the server honored the preference.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "examples": { + "still_processing": { + "summary": "Registration still in progress", + "value": { + "errors": [], + "messages": [], + "result": { + "completed": false, + "context": { + "domain_name": "example.com" + }, + "created_at": "2025-10-27T10:00:00Z", + "links": { + "resource": "/accounts/abc/registrar/registrations/example.com", + "self": "/accounts/abc/registrar/registrations/example.com/registration-status" + }, + "state": "in_progress", + "updated_at": "2025-10-27T10:00:10Z" + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_workflow-status-response-single" + } + } + } + }, + "4XX": { + "description": "Create registration failure.", + "content": { + "application/json": { + "examples": { + "account_domain_limit_exceeded": { + "description": "The account already owns the maximum supported number of domains.\nDomains created through either the dashboard or this API count\ntoward the same account-wide limit.\n", + "summary": "Account has reached the domain limit", + "value": { + "errors": [ + { + "code": 10000, + "message": "Domain limit reached: you cannot register more than 500 domains.", + "source": { + "pointer": "/domain_name" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "domain_name_required": { + "description": "The required `domain_name` field was not provided.", + "summary": "Missing domain name", + "value": { + "errors": [ + { + "code": 10000, + "message": "domain_name is required", + "source": { + "pointer": "/domain_name" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "invalid_auto_renew": { + "description": "The `auto_renew` field must be a boolean if present.", + "summary": "Invalid auto_renew value", + "value": { + "errors": [ + { + "code": 10000, + "message": "Must be a boolean", + "source": { + "pointer": "/auto_renew" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "missing_contact": { + "description": "The request did not include a registrant contact, and the account\nhas no default address book entry to fall back to. Either provide\ncontacts.registrant in the request or set up a default address\nbook entry at `https://dash.cloudflare.com/{account_id}/domains/registrations`.\n", + "summary": "No registrant contact and no default address book entry", + "value": { + "errors": [ + { + "code": 10000, + "message": "No registrant contact provided and no default address book entry found for this account." + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "registration_not_supported": { + "description": "The extension is not supported for registration through this API.\nThis includes extensions that are unsupported by the API or do\nnot support the required registration contact flow.\n", + "summary": "Registration not supported for extension", + "value": { + "errors": [ + { + "code": 10000, + "message": "Registration is not supported for this extension" + } + ], + "messages": [], + "result": null, + "success": false + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "security": [ + { + "api_token": [] + }, + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Registrar Registration" + ], + "x-fern-availability": "generally-available", + "x-fern-sdk-group-name": "registrar.registrations", + "x-fern-sdk-method-name": "create" + } + }, + "/tenants/{tenant_id}": { + "get": { + "operationId": "Tenants_retrieveTenant", + "summary": "Get tenant details", + "description": "Retrieves a tenant's identity, status, metadata, contacts, and organizational units.", + "parameters": [ + { + "name": "tenant_id", + "in": "path", + "description": "The ID of the tenant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object" + }, + "maxItems": 0 + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/organizations-api_V4Message" + } + }, + "result": { + "$ref": "#/components/schemas/organizations-api_Tenant" + }, + "success": { + "type": "boolean", + "enum": [ + true + ] + } + }, + "required": [ + "success", + "errors", + "messages", + "result" + ] + } + } + } + }, + "4XX": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/organizations-api_V4ErrorResponse" + } + } + } + } + }, + "security": [ + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Tenants" + ], + "x-fern-availability": "generally-available", + "x-fern-sdk-group-name": "tenant", + "x-fern-sdk-method-name": "get" + } + } + } +} diff --git a/plugins/openapi/testdata/cloudflare-2026-10-30.json b/plugins/openapi/testdata/cloudflare-2026-10-30.json new file mode 100644 index 0000000..a1f2ad5 --- /dev/null +++ b/plugins/openapi/testdata/cloudflare-2026-10-30.json @@ -0,0 +1,830 @@ +{ + "openapi": "3.0.3", + "info": { + "description": "Welcome to Cloudflare's API documentation site. We are experimenting with an updated version of our API documentation - check out [developers.cloudflare.com/api-next/](https://developers.cloudflare.com/api-next/) to test out the new experience.\n\nTo get started using Cloudflare's products and services via the API, refer to [how to interact with Cloudflare](https://developers.cloudflare.com/fundamentals/basic-tasks/interact-with-cloudflare/), which covers using tools like [Terraform](https://developers.cloudflare.com/terraform/#cloudflare-terraform) and the [official SDKs](https://developers.cloudflare.com/fundamentals/api/reference/sdks/) to maintain your Cloudflare resources.\n\nUsing the Cloudflare API requires authentication so that Cloudflare knows who is making requests and what permissions you have. Create an API token to grant access to the API to perform actions. You can also authenticate with [API keys](https://developers.cloudflare.com/fundamentals/api/get-started/keys/), but these keys have [several limitations](https://developers.cloudflare.com/fundamentals/api/get-started/keys/#limitations) that make them less secure than API tokens. Whenever possible, use API tokens to interact with the Cloudflare API.\n\nTo create an API token, from the Cloudflare dashboard, go to My Profile > API Tokens and select Create Token. For more information on how to create and troubleshoot API tokens, refer to\nour [API fundamentals](https://developers.cloudflare.com/fundamentals/api/).\n\nFor information regarding rate limits, refer to our [API Rate Limits](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/platform/limits/#api-rate-limits).\n\nTotally new to Cloudflare? [Start here](https://developers.cloudflare.com/fundamentals/get-started/).", + "license": { + "name": "BSD-3-Clause", + "url": "https://opensource.org/licenses/BSD-3-Clause" + }, + "title": "Cloudflare API", + "version": "4.0.0" + }, + "servers": [ + { + "description": "Client API", + "url": "https://api.cloudflare.com/client/v4" + } + ], + "paths": { + "/accounts/{account_id}/registrar/registrations": { + "get": { + "operationId": "registrar-domain-registration-list", + "summary": "List Registrations", + "description": "Returns a paginated list of domain registrations owned by the account.\n\nThis endpoint uses cursor-based pagination. Results are ordered by registration\ndate by default. To fetch the next page, pass the `cursor` value from the\n`result_info` object in the response as the `cursor` query parameter in\nyour next request. An empty `cursor` string indicates there are no more\npages.\n", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "Cloudflare account ID.", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_cursor" + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_per_page" + }, + { + "$ref": "#/components/parameters/registrar-api_cursor_pagination_direction" + }, + { + "name": "sort_by", + "in": "query", + "description": "Column to sort results by. Defaults to registration date (`registry_created_at`) when omitted.", + "schema": { + "type": "string", + "default": "registry_created_at", + "enum": [ + "registry_created_at", + "registry_expires_at", + "name" + ] + } + } + ], + "responses": { + "200": { + "description": "List of registrations for the account.", + "content": { + "application/json": { + "examples": { + "empty_account": { + "summary": "Account with no registrations", + "value": { + "errors": [], + "messages": [], + "result": [], + "result_info": { + "count": 0, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "multiple_domains": { + "summary": "Account with multiple domains", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2025-01-15T10:00:00Z", + "domain_name": "example.com", + "expires_at": "2026-01-15T10:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2025-03-20T14:30:00Z", + "domain_name": "mybrand.dev", + "expires_at": "2026-03-20T14:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 2, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "next_page": { + "description": "Response when fetching the next page by passing the cursor from a previous response. The empty cursor indicates this is the last page.", + "summary": "Next page of results (last page)", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2025-04-01T09:00:00Z", + "domain_name": "charlie.org", + "expires_at": "2026-04-01T09:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 1, + "cursor": "", + "per_page": 20 + }, + "success": true + } + }, + "paginated": { + "summary": "First page with more results available", + "value": { + "errors": [], + "messages": [], + "result": [ + { + "auto_renew": true, + "created_at": "2024-01-15T09:30:00Z", + "domain_name": "acmecorp.com", + "expires_at": "2026-01-15T09:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-02-20T14:00:00Z", + "domain_name": "brightwave.net", + "expires_at": "2026-02-20T14:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-03-05T11:15:00Z", + "domain_name": "cloudpeak.org", + "expires_at": "2026-03-05T11:15:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-03-22T08:45:00Z", + "domain_name": "solarpanel.io", + "expires_at": "2026-03-22T08:45:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-04-10T16:00:00Z", + "domain_name": "greenleaf.dev", + "expires_at": "2026-04-10T16:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-05-03T10:30:00Z", + "domain_name": "swiftrunner.app", + "expires_at": "2026-05-03T10:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-05-18T13:00:00Z", + "domain_name": "northerntrail.co", + "expires_at": "2025-05-18T13:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "expired" + }, + { + "auto_renew": true, + "created_at": "2024-06-01T07:20:00Z", + "domain_name": "pixelforge.xyz", + "expires_at": "2026-06-01T07:20:00Z", + "locked": false, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-06-25T15:45:00Z", + "domain_name": "oceandrift.com", + "expires_at": "2026-06-25T15:45:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-07-12T09:00:00Z", + "domain_name": "rocketlaunch.net", + "expires_at": "2026-07-12T09:00:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-08-08T12:30:00Z", + "domain_name": "blueprintlab.io", + "expires_at": "2026-08-08T12:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-09-01T18:00:00Z", + "domain_name": "maplewood.org", + "expires_at": "2026-09-01T18:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2024-09-20T10:15:00Z", + "domain_name": "thunderbolt.dev", + "expires_at": "2025-09-20T10:15:00Z", + "locked": false, + "privacy_mode": "off", + "status": "expired" + }, + { + "auto_renew": true, + "created_at": "2024-10-05T14:45:00Z", + "domain_name": "silverbranch.app", + "expires_at": "2026-10-05T14:45:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-11-11T08:00:00Z", + "domain_name": "nightowl.co", + "expires_at": "2026-11-11T08:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2024-12-01T11:30:00Z", + "domain_name": "crimsongate.com", + "expires_at": "2026-12-01T11:30:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": false, + "created_at": "2025-01-07T16:20:00Z", + "domain_name": "frostedpine.net", + "expires_at": "2027-01-07T16:20:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-01-25T09:50:00Z", + "domain_name": "horizonline.xyz", + "expires_at": "2027-01-25T09:50:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-02-14T13:00:00Z", + "domain_name": "coppervine.io", + "expires_at": "2027-02-14T13:00:00Z", + "locked": true, + "privacy_mode": "off", + "status": "active" + }, + { + "auto_renew": true, + "created_at": "2025-03-02T07:40:00Z", + "domain_name": "starlitpath.org", + "expires_at": "2027-03-02T07:40:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + ], + "result_info": { + "count": 20, + "cursor": "eyJ0IjoiMjAyNS0wNi0xNVQxMjowMDowMC4wMDAwMDBaIiwibiI6ImJyYXZvLm5ldCJ9", + "per_page": 20 + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_registration-response-collection" + } + } + } + }, + "4XX": { + "description": "List registrations failure.", + "content": { + "application/json": { + "examples": { + "invalid_cursor": { + "summary": "Invalid cursor", + "value": { + "errors": [ + { + "code": 10000, + "message": "Invalid pagination cursor" + } + ], + "messages": [], + "result": null, + "success": false + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "security": [ + { + "api_token": [] + }, + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Registrar Registration" + ], + "x-fern-availability": "generally-available", + "x-fern-sdk-group-name": "registrar.registrations", + "x-fern-sdk-method-name": "list" + }, + "post": { + "operationId": "registrar-domain-registration-create", + "summary": "Create Registration", + "description": "Starts a domain registration workflow. This is a billable operation — successful\nregistration charges the account's default payment method. All successful\ndomain registrations are non-refundable — once the workflow completes with\n`state: succeeded`, the charge cannot be reversed.\n\n### Prerequisites\n- The account must have a billing profile with a valid default payment method.\n Set this up at `https://dash.cloudflare.com/{account_id}/billing/payment-info`.\n- The account must not already be at the maximum supported domain limit.\n A single account may own up to 500 domains in total across registrations\n created through either the dashboard or this API.\n- The domain must be on a supported extension for programmatic registration.\n- Use `POST /domain-check` immediately before calling this endpoint to confirm\n real-time availability and pricing.\n\n### Supported extensions\n\nThis API supports programmatic registration for all extensions supported by\nthe dashboard experience, with the following exceptions:\n\n`giving`, `mom`, `inc`, `lol`, `sh`, `link`, `cc`, `new`\n\nCloudflare Registrar supports 400+ extensions in the dashboard. Extensions\nlisted above can be registered at\n`https://dash.cloudflare.com/{account_id}/domains/registrations`.\n\n### Express mode\nThe only required field is `domain_name`. If `contacts` is omitted, the system\nuses the account's default address book entry as the registrant. If no default\nexists and no contact is provided, the request fails. Set up a default address\nbook entry and accept the required agreement at\n`https://dash.cloudflare.com/{account_id}/domains/registrations`.\n\n### Defaults\n- `years`: defaults to the extension's minimum registration period (1 year for\n most extensions, but varies — for example, `.ai` (if supported) requires a minimum of 2 years).\n- `auto_renew`: defaults to `false`. Setting it to `true` is an explicit\n opt-in authorizing Cloudflare to charge the account's default payment\n method up to 30 days before domain expiry to renew the registration.\n Renewal pricing may change over time based on registry pricing.\n- `privacy_mode`: defaults to `redaction`.\n\n### Premium domains\nPremium domain registration is not currently supported by this API.\nIf `POST /domain-check` returns `tier: premium`, do not call this\nendpoint for that domain.\n\n### Response behavior\nBy default, the server holds the connection for a bounded, server-defined\namount of time while the registration completes. Most registrations finish\nwithin this window and return `201 Created` with a completed workflow status.\n\nIf the registration is still processing after this synchronous wait window,\nthe server returns `202 Accepted`. Poll the URL in `links.self` to track progress.\n\nTo skip the wait and receive an immediate `202`, send `Prefer: respond-async`.\n", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "Cloudflare account ID. Required for all Registrar API operations.", + "required": true, + "schema": { + "$ref": "#/components/schemas/registrar-api_identifier" + } + }, + { + "name": "Prefer", + "in": "header", + "description": "Set to `respond-async` to receive an immediate `202 Accepted` without\nwaiting for the operation to complete (RFC 7240).\n\nThe header may be combined with other preferences using standard\ncomma-separated syntax.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "examples": { + "ca_with_contact_extensions": { + "description": "CA registrations require a registrant legal type.\nProvide the required value in `contact_extensions` as described\nby the live .ca registration schema.\n", + "summary": "Register a .ca domain with legal type", + "value": { + "auto_renew": false, + "contact_extensions": { + "ca_legal_type": "CCT" + }, + "contacts": { + "registrant": { + "email": "ada@example.ca", + "phone": "+1.6135550100", + "postal_info": { + "address": { + "city": "Ottawa", + "country_code": "CA", + "postal_code": "K1A 0B1", + "state": true, + "street": "123 Queen St" + }, + "name": "Ada Lovelace", + "organization": "Example Canada Inc" + } + } + }, + "domain_name": "my-brand-example.ca", + "years": 1 + } + }, + "io_with_role_contacts": { + "description": "Some extension schemas accept additional standard contact roles such as `technical`, `administrator`, and `billing`. When these roles are provided explicitly, Cloudflare preserves the supplied role-specific contact data instead of deriving it from `contacts.registrant`.", + "summary": "Register with explicit role contacts", + "value": { + "auto_renew": false, + "contacts": { + "administrator": { + "email": "katherine@example.io", + "phone": "+1.5555550102", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94103", + "state": "CA", + "street": "789 Mission St" + }, + "name": "Katherine Johnson", + "organization": "Example Admin Inc" + } + }, + "billing": { + "email": "dorothy@example.io", + "phone": "+1.5555550103", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94105", + "state": "CA", + "street": "101 Howard St" + }, + "name": "Dorothy Vaughan", + "organization": "Example Billing Inc" + } + }, + "registrant": { + "email": "ada@example.io", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + }, + "technical": { + "email": "grace@example.io", + "phone": "+1.5555550101", + "postal_info": { + "address": { + "city": "San Francisco", + "country_code": "US", + "postal_code": "94105", + "state": "CA", + "street": "456 Market St" + }, + "name": "Grace Hopper", + "organization": "Example Technical Inc" + } + } + }, + "domain_name": "my-brand-example.io", + "years": 1 + } + }, + "minimal": { + "description": "The simplest registration request uses the following defaults.\n- `years` defaults to the extension's minimum registration period (typically 1 year).\n- `auto_renew` defaults to `false`.\n- `privacy_mode` defaults to `redaction`.\n- Registrant contact falls back to the account's default address book entry.\n", + "summary": "Minimal registration — just a domain name", + "value": { + "domain_name": "my-new-startup.com" + } + }, + "multi_year": { + "description": "Register a domain for 3 years.", + "summary": "Register for multiple years", + "value": { + "domain_name": "longterm-project.dev", + "years": 3 + } + }, + "uk_with_contact_extensions": { + "description": ".uk registrations can require registrant type information. For\norganization registrants, include the company number when the\nlive registration schema requires it.\n", + "summary": "Register a .uk domain with registrant type", + "value": { + "auto_renew": false, + "contact_extensions": { + "company_number": "12345678", + "registrant_type": "LTD" + }, + "contacts": { + "registrant": { + "email": "ada@example.co.uk", + "phone": "+44.2071234567", + "postal_info": { + "address": { + "city": "London", + "country_code": "GB", + "postal_code": "SW1A 1AA", + "state": "London", + "street": "1 Example Street" + }, + "name": "Ada Lovelace", + "organization": "Example UK Ltd" + } + } + }, + "domain_name": "my-brand-example.uk", + "years": 1 + } + }, + "us_with_contact_extensions": { + "description": "Some extensions require registry-specific contact extension\nvalues in addition to the standard registrant contact. The\nextension discovery endpoint is authoritative for the required\nkeys and allowed values.\n", + "summary": "Register a .us domain with contact extensions", + "value": { + "auto_renew": false, + "contact_extensions": { + "application_purpose": "P3", + "nexus_category": "C11" + }, + "contacts": { + "registrant": { + "email": "ada@example.com", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + } + }, + "domain_name": "my-brand-example.us", + "years": 1 + } + }, + "with_contact": { + "description": "Provide registrant contact data inline if the account does not have\na default address book entry, or to override it for this registration.\n`postal_info.name` is the complete contact name in one field.\nSome registries require a complete personal name, including a\nfamily or last name where applicable, but this API does not\naccept separate first-name and last-name fields.\n", + "summary": "Register with explicit registrant contact", + "value": { + "auto_renew": true, + "contacts": { + "registrant": { + "email": "ada@example.com", + "phone": "+1.5555555555", + "postal_info": { + "address": { + "city": "Austin", + "country_code": "US", + "postal_code": "78701", + "state": "TX", + "street": "123 Main St" + }, + "name": "Ada Lovelace", + "organization": "Example Inc" + } + } + }, + "domain_name": "example.com", + "years": 1 + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_registration_create_request" + } + } + } + }, + "responses": { + "201": { + "description": "Registration completed successfully within the synchronous wait window.\nThe workflow status will have `state: succeeded` and `completed: true`.\n", + "headers": { + "Preference-Applied": { + "description": "Echoed when the server honored a `Prefer` header.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "examples": { + "completed": { + "summary": "Registration completed within timeout (most common)", + "value": { + "errors": [], + "messages": [], + "result": { + "completed": true, + "context": { + "domain_name": "example.com", + "registration": { + "auto_renew": true, + "created_at": "2025-10-27T10:00:00Z", + "domain_name": "example.com", + "expires_at": "2026-10-27T10:00:00Z", + "locked": true, + "privacy_mode": "redaction", + "status": "active" + } + }, + "created_at": "2025-10-27T10:00:00Z", + "links": { + "resource": "/accounts/abc/registrar/registrations/example.com", + "self": "/accounts/abc/registrar/registrations/example.com/registration-status" + }, + "state": "succeeded", + "updated_at": "2025-10-27T10:00:03Z" + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_workflow-status-response-single" + } + } + } + }, + "202": { + "description": "Registration is still processing. This occurs when the operation did\nnot complete within the synchronous wait window, or when `Prefer: respond-async`\nwas sent. Poll the URL in `links.self` to track progress.\n", + "headers": { + "Location": { + "description": "URL of the workflow status resource (same as `links.self`).", + "schema": { + "type": "string" + } + }, + "Preference-Applied": { + "description": "Set to `respond-async` when the server honored the preference.", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "examples": { + "still_processing": { + "summary": "Registration still in progress", + "value": { + "errors": [], + "messages": [], + "result": { + "completed": false, + "context": { + "domain_name": "example.com" + }, + "created_at": "2025-10-27T10:00:00Z", + "links": { + "resource": "/accounts/abc/registrar/registrations/example.com", + "self": "/accounts/abc/registrar/registrations/example.com/registration-status" + }, + "state": "in_progress", + "updated_at": "2025-10-27T10:00:10Z" + }, + "success": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_workflow-status-response-single" + } + } + } + }, + "4XX": { + "description": "Create registration failure.", + "content": { + "application/json": { + "examples": { + "account_domain_limit_exceeded": { + "description": "The account already owns the maximum supported number of domains.\nDomains created through either the dashboard or this API count\ntoward the same account-wide limit.\n", + "summary": "Account has reached the domain limit", + "value": { + "errors": [ + { + "code": 10000, + "message": "Domain limit reached: you cannot register more than 500 domains.", + "source": { + "pointer": "/domain_name" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "domain_name_required": { + "description": "The required `domain_name` field was not provided.", + "summary": "Missing domain name", + "value": { + "errors": [ + { + "code": 10000, + "message": "domain_name is required", + "source": { + "pointer": "/domain_name" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "invalid_auto_renew": { + "description": "The `auto_renew` field must be a boolean if present.", + "summary": "Invalid auto_renew value", + "value": { + "errors": [ + { + "code": 10000, + "message": "Must be a boolean", + "source": { + "pointer": "/auto_renew" + } + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "missing_contact": { + "description": "The request did not include a registrant contact, and the account\nhas no default address book entry to fall back to. Either provide\ncontacts.registrant in the request or set up a default address\nbook entry at `https://dash.cloudflare.com/{account_id}/domains/registrations`.\n", + "summary": "No registrant contact and no default address book entry", + "value": { + "errors": [ + { + "code": 10000, + "message": "No registrant contact provided and no default address book entry found for this account." + } + ], + "messages": [], + "result": null, + "success": false + } + }, + "registration_not_supported": { + "description": "The extension is not supported for registration through this API.\nThis includes extensions that are unsupported by the API or do\nnot support the required registration contact flow.\n", + "summary": "Registration not supported for extension", + "value": { + "errors": [ + { + "code": 10000, + "message": "Registration is not supported for this extension" + } + ], + "messages": [], + "result": null, + "success": false + } + } + }, + "schema": { + "$ref": "#/components/schemas/registrar-api_api-response-common-failure" + } + } + } + } + }, + "security": [ + { + "api_token": [] + }, + { + "api_email": [], + "api_key": [] + } + ], + "tags": [ + "Registrar Registration" + ], + "x-fern-availability": "generally-available", + "x-fern-sdk-group-name": "registrar.registrations", + "x-fern-sdk-method-name": "create" + } + } + } +} diff --git a/plugins/openapi/testdata/golden/cloudflare-api-spec.json b/plugins/openapi/testdata/golden/cloudflare-api-spec.json new file mode 100644 index 0000000..4838ef6 --- /dev/null +++ b/plugins/openapi/testdata/golden/cloudflare-api-spec.json @@ -0,0 +1,65 @@ +[ + { + "id": 1, + "fingerprint": "sha256:9ae82e58fc8968d19a7177ff87875316b2988bf188b7d4a1e2aa036ba1864720", + "api": "cloudflare/api-spec", + "version": "2026-10-30", + "previous_version": "2026-10-29", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /client/v4/accounts/{account_id}/registrar/domains" + }, + "description": "Operation GET /client/v4/accounts/{account_id}/registrar/domains removed.", + "source_url": "https://raw.githubusercontent.com/cloudflare/api-schemas/46a48d5eba1d8a839cd8cc5712d2b9368e21e654/openapi.json", + "source_pointer": "/paths/~1accounts~1{account_id}~1registrar~1domains/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Lists domains handled by Registrar.\",\"operationId\":\"registrar-domains-list-domains\",\"parameters\":[{\"in\":\"path\",\"name\":\"account_id\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_identifier\"}}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_response_collection\"}}},\"description\":\"List domains response.\"},\"4XX\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_api-response-common-failure\"}}},\"description\":\"List domains response failure.\"}},\"security\":[{\"api_email\":[],\"api_key\":[],\"api_token\":[]}],\"summary\":\"List domains\",\"tags\":[\"Registrar Domains\"],\"x-api-token-group\":null,\"x-fern-ignore\":true,\"x-fern-sdk-group-name\":\"registrar.legacy\",\"x-fern-sdk-method-name\":\"list-domains\",\"x-stainless-deprecation-message\":\"This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details.\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:9cde00a0f01a8aa044725ce3ff49ab6d6ac313cc87d406ccff97588046adeeb0", + "api": "cloudflare/api-spec", + "version": "2026-10-30", + "previous_version": "2026-10-29", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /client/v4/accounts/{account_id}/registrar/domains/{domain_name}" + }, + "description": "Operation GET /client/v4/accounts/{account_id}/registrar/domains/{domain_name} removed.", + "source_url": "https://raw.githubusercontent.com/cloudflare/api-schemas/46a48d5eba1d8a839cd8cc5712d2b9368e21e654/openapi.json", + "source_pointer": "/paths/~1accounts~1{account_id}~1registrar~1domains~1{domain_name}/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Show individual domain.\",\"operationId\":\"registrar-domains-get-domain\",\"parameters\":[{\"in\":\"path\",\"name\":\"domain_name\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_name\"}},{\"in\":\"path\",\"name\":\"account_id\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_identifier\"}}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_response_single\"}}},\"description\":\"Get domain response.\"},\"4XX\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_api-response-common-failure\"}}},\"description\":\"Get domain response failure.\"}},\"security\":[{\"api_email\":[],\"api_key\":[],\"api_token\":[]}],\"summary\":\"Get domain\",\"tags\":[\"Registrar Domains\"],\"x-api-token-group\":null,\"x-fern-ignore\":true,\"x-fern-sdk-group-name\":\"registrar.legacy\",\"x-fern-sdk-method-name\":\"get-domain\",\"x-stainless-deprecation-message\":\"This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details.\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:dfc96b1305887adc93c67c27aaff84d606242b16b68852b7d32f612848fe4eb6", + "api": "cloudflare/api-spec", + "version": "2026-10-30", + "previous_version": "2026-10-29", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "PUT /client/v4/accounts/{account_id}/registrar/domains/{domain_name}" + }, + "description": "Operation PUT /client/v4/accounts/{account_id}/registrar/domains/{domain_name} removed.", + "source_url": "https://raw.githubusercontent.com/cloudflare/api-schemas/46a48d5eba1d8a839cd8cc5712d2b9368e21e654/openapi.json", + "source_pointer": "/paths/~1accounts~1{account_id}~1registrar~1domains~1{domain_name}/put", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Updates an individual domain.\",\"operationId\":\"registrar-domains-update-domain\",\"parameters\":[{\"in\":\"path\",\"name\":\"domain_name\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_name\"}},{\"in\":\"path\",\"name\":\"account_id\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_identifier\"}}],\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_update_properties\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_domain_response_single\"}}},\"description\":\"Update domain response.\"},\"4XX\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/registrar-api_api-response-common-failure\"}}},\"description\":\"Update domain response failure.\"}},\"security\":[{\"api_email\":[],\"api_key\":[],\"api_token\":[]}],\"summary\":\"Update domain\",\"tags\":[\"Registrar Domains\"],\"x-api-token-group\":null,\"x-fern-ignore\":true,\"x-fern-sdk-group-name\":\"registrar.legacy\",\"x-fern-sdk-method-name\":\"update-domain\",\"x-stainless-deprecation-message\":\"This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead. Refer to https://developers.cloudflare.com/fundamentals/api/reference/deprecations/ for details.\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/openapi/testdata/golden/mongodb-atlas-admin-spec.json b/plugins/openapi/testdata/golden/mongodb-atlas-admin-spec.json new file mode 100644 index 0000000..7df2296 --- /dev/null +++ b/plugins/openapi/testdata/golden/mongodb-atlas-admin-spec.json @@ -0,0 +1,65 @@ +[ + { + "id": 1, + "fingerprint": "sha256:bf859db9c8dc9bc0989b717158e6c8da3c33a351ddcd06320d39d164399983a1", + "api": "mongodb/atlas-admin-spec", + "version": "2025-02-20", + "previous_version": "2025-02-18", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /api/atlas/v2/users" + }, + "description": "Operation POST /api/atlas/v2/users marked deprecated.", + "source_url": "https://raw.githubusercontent.com/mongodb/openapi/28b2c6fc35a44b3272d7afbcaae380e1d28f0e45/openapi/v2.json", + "source_pointer": "/paths/~1api~1atlas~1v2~1users/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Creates one MongoDB Cloud user account. A MongoDB Cloud user account grants access to only the MongoDB Cloud application. To grant database access, create a database user. MongoDB Cloud sends an email to the users you specify, inviting them to join the project. Invited users don't have access to the project until they accept the invitation. Invitations expire after 30 days.\\n\\n MongoDB Cloud limits MongoDB Cloud user membership to a maximum of 250 MongoDB Cloud users per team. MongoDB Cloud limits MongoDB Cloud user membership to 500 MongoDB Cloud users per project and 500 MongoDB Cloud users per organization, which includes the combined membership of all projects in the organization. MongoDB Cloud raises an error if an operation exceeds these limits. For example, if you have an organization with five projects, and each project has 100 MongoDB Cloud users, and each MongoDB Cloud user belongs to only one project, you can't add any MongoDB Cloud users to this organization without first removing existing MongoDB Cloud users from the organization.\\n\\n To use this resource, the requesting API Key can have any role.\",\"operationId\":\"createUser\",\"parameters\":[{\"$ref\":\"#/components/parameters/envelope\"},{\"$ref\":\"#/components/parameters/pretty\"}],\"requestBody\":{\"content\":{\"application/vnd.atlas.2023-01-01+json\":{\"schema\":{\"$ref\":\"#/components/schemas/CloudAppUser\"}}},\"description\":\"MongoDB Cloud user account to create.\",\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/vnd.atlas.2023-01-01+json\":{\"schema\":{\"$ref\":\"#/components/schemas/CloudAppUser\"},\"x-sunset\":\"2026-07-31\",\"x-xgen-version\":\"2023-01-01\"}},\"description\":\"OK\"},\"401\":{\"$ref\":\"#/components/responses/unauthorized\"},\"404\":{\"$ref\":\"#/components/responses/notFound\"},\"500\":{\"$ref\":\"#/components/responses/internalServerError\"}},\"summary\":\"Create One MongoDB Cloud User\",\"tags\":[\"MongoDB Cloud Users\"],\"x-xgen-docs-url\":\"https://mongodb.com/docs/atlas/reference/api-resources-sp…", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:a3aa3511e381f1383080ebb27a53c93e640767f1fae251996ed22cf82886f4e3", + "api": "mongodb/atlas-admin-spec", + "version": "2025-02-20", + "previous_version": "2025-02-18", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /api/atlas/v2/users/byName/{userName}" + }, + "description": "Operation GET /api/atlas/v2/users/byName/{userName} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/mongodb/openapi/28b2c6fc35a44b3272d7afbcaae380e1d28f0e45/openapi/v2.json", + "source_pointer": "/paths/~1api~1atlas~1v2~1users~1byName~1{userName}/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Returns the details for one MongoDB Cloud user account with the specified username. You can't use this endpoint to return information about an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. To use this resource, the requesting API Key can have any role.\",\"operationId\":\"getUserByUsername\",\"parameters\":[{\"$ref\":\"#/components/parameters/envelope\"},{\"$ref\":\"#/components/parameters/pretty\"},{\"description\":\"Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.\",\"in\":\"path\",\"name\":\"userName\",\"required\":true,\"schema\":{\"pattern\":\"^[a-z0-9!#$%\\u0026'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%\\u0026'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$\",\"type\":\"string\"}}],\"responses\":{\"200\":{\"content\":{\"application/vnd.atlas.2023-01-01+json\":{\"schema\":{\"$ref\":\"#/components/schemas/CloudAppUser\"},\"x-sunset\":\"2026-07-31\",\"x-xgen-version\":\"2023-01-01\"}},\"description\":\"OK\"},\"401\":{\"$ref\":\"#/components/responses/unauthorized\"},\"404\":{\"$ref\":\"#/components/responses/notFound\"},\"500\":{\"$ref\":\"#/components/responses/internalServerError\"}},\"summary\":\"Return One MongoDB Cloud User using Their Username\",\"tags\":[\"MongoDB Cloud Users\"],\"x-xgen-docs-url\":\"https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUserByUsername\",\"x-xgen-owner-team\":\"IAM\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:7cde782926abc9ce73653bdf74193a84217753231a334852e60ab894674a0bbb", + "api": "mongodb/atlas-admin-spec", + "version": "2025-02-20", + "previous_version": "2025-02-18", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /api/atlas/v2/users/{userId}" + }, + "description": "Operation GET /api/atlas/v2/users/{userId} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/mongodb/openapi/28b2c6fc35a44b3272d7afbcaae380e1d28f0e45/openapi/v2.json", + "source_pointer": "/paths/~1api~1atlas~1v2~1users~1{userId}/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Returns the details for one MongoDB Cloud user account with the specified unique identifier for the user. You can't use this endpoint to return information on an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. You can always retrieve your own user account. If you are the owner of a MongoDB Cloud organization or project, you can also retrieve the user profile for any user with membership in that organization or project. To use this resource, the requesting API Key can have any role.\",\"operationId\":\"getUser\",\"parameters\":[{\"$ref\":\"#/components/parameters/envelope\"},{\"$ref\":\"#/components/parameters/pretty\"},{\"description\":\"Unique 24-hexadecimal digit string that identifies this user.\",\"in\":\"path\",\"name\":\"userId\",\"required\":true,\"schema\":{\"pattern\":\"^([a-f0-9]{24})$\",\"type\":\"string\"}}],\"responses\":{\"200\":{\"content\":{\"application/vnd.atlas.2023-01-01+json\":{\"schema\":{\"$ref\":\"#/components/schemas/CloudAppUser\"},\"x-sunset\":\"2044-01-01\",\"x-xgen-version\":\"2023-01-01\"}},\"description\":\"OK\"},\"401\":{\"$ref\":\"#/components/responses/unauthorized\"},\"404\":{\"$ref\":\"#/components/responses/notFound\"},\"500\":{\"$ref\":\"#/components/responses/internalServerError\"}},\"summary\":\"Return One MongoDB Cloud User using Its ID\",\"tags\":[\"MongoDB Cloud Users\"],\"x-xgen-docs-url\":\"https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUser\",\"x-xgen-owner-team\":\"IAM\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/openapi/testdata/golden/openai-api.json b/plugins/openapi/testdata/golden/openai-api.json new file mode 100644 index 0000000..528229f --- /dev/null +++ b/plugins/openapi/testdata/golden/openai-api.json @@ -0,0 +1,23 @@ +[ + { + "id": 1, + "fingerprint": "sha256:fe20f958f779ea71cf22a7ab8f02ed3c6b50d393e95dc617b3d6fac6371f41f2", + "api": "openai/api", + "version": "2026-10-28", + "previous_version": "2026-10-27", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /v1/audio/translations" + }, + "description": "Operation POST /v1/audio/translations marked deprecated.", + "source_url": "https://raw.githubusercontent.com/openai/openai-openapi/aa880040fa7b23c8a7e3618b5ca757ecec71de95/openapi.yaml", + "source_pointer": "/paths/~1audio~1translations/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Translates audio into English.\\n\\nThis endpoint supports only `whisper-1`. The endpoint and model are deprecated\\nand scheduled to shut down on February 26, 2027. Migrate to\\n`/v1/realtime/translations`, which requires a separate integration. See the\\n[deprecation schedule](https://developers.openai.com/api/docs/deprecations)\\nfor details.\\n\",\"operationId\":\"createTranslation\",\"requestBody\":{\"content\":{\"multipart/form-data\":{\"schema\":{\"$ref\":\"#/components/schemas/CreateTranslationRequest\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"oneOf\":[{\"$ref\":\"#/components/schemas/CreateTranslationResponseJson\"},{\"$ref\":\"#/components/schemas/CreateTranslationResponseVerboseJson\"}]}},\"text/plain\":{\"schema\":{\"type\":\"string\"}}},\"description\":\"OK\"},\"400\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorResponse\"}}},\"description\":\"Invalid audio input or request parameters.\"},\"401\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorResponse\"}},\"text/plain\":{\"schema\":{\"description\":\"JSON-encoded error text containing an error object and the HTTP status.\",\"type\":\"string\"}}},\"description\":\"Authentication failed because the API key is missing or revoked, or the client IP is not authorized.\"},\"403\":{\"content\":{\"text/plain\":{\"schema\":{\"description\":\"JSON-encoded error text containing an error object and the HTTP status.\",\"type\":\"string\"}}},\"description\":\"Access to a personal API organization is blocked by the organization policy.\"},\"413\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorResponse\"}}},\"description\":\"The audio request exceeds the supported size limit.\"},\"429\":{\"$ref\":\"#/components/responses/InferenceRateLimited\"},\"500\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorResponse\"}}},\"description\":\"The audio could not be processed.\"},\"502\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/sche…", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/openapi/testdata/mongodb-atlas-2024-07-25.json b/plugins/openapi/testdata/mongodb-atlas-2024-07-25.json new file mode 100644 index 0000000..dfd2e89 --- /dev/null +++ b/plugins/openapi/testdata/mongodb-atlas-2024-07-25.json @@ -0,0 +1,105 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal:\n\n```\ncurl --user \"{PUBLIC-KEY}:{PRIVATE-KEY}\" \\\n --digest \\\n --header \"Accept: application/vnd.atlas.2025-01-01+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true\"\n```\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).", + "license": { + "name": "CC BY-NC-SA 3.0 US", + "url": "https://creativecommons.org/licenses/by-nc-sa/3.0/us/" + }, + "termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions", + "title": "MongoDB Atlas Administration API", + "version": "2.0" + }, + "servers": [ + { + "url": "https://cloud.mongodb.com" + } + ], + "paths": { + "/rest/unauth/version": { + "get": { + "description": "This resource returns the deployed gitSHA for the service.", + "operationId": "getVersion", + "parameters": [ + { + "$ref": "#/components/parameters/pretty" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionView" + } + } + }, + "description": "OK" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "security": [ + { + "DigestAuth": [] + } + ], + "summary": "Return the deployed gitSHA.", + "tags": [ + "Internal" + ] + } + }, + "/api/atlas/v2": { + "get": { + "description": "This resource returns information about the MongoDB application along with API key meta data.", + "operationId": "getSystemStatus", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/SystemStatus" + }, + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiError" + } + } + }, + "description": "Unauthorized." + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "security": [ + { + "DigestAuth": [] + } + ], + "summary": "Return the status of this MongoDB application", + "tags": [ + "Root" + ], + "x-xgen-owner-team": "apix" + } + } + } +} diff --git a/plugins/openapi/testdata/mongodb-atlas-2024-08-07.json b/plugins/openapi/testdata/mongodb-atlas-2024-08-07.json new file mode 100644 index 0000000..cfa9635 --- /dev/null +++ b/plugins/openapi/testdata/mongodb-atlas-2024-08-07.json @@ -0,0 +1,70 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal:\n\n```\ncurl --user \"{PUBLIC-KEY}:{PRIVATE-KEY}\" \\\n --digest \\\n --header \"Accept: application/vnd.atlas.2025-01-01+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true\"\n```\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).", + "license": { + "name": "CC BY-NC-SA 3.0 US", + "url": "https://creativecommons.org/licenses/by-nc-sa/3.0/us/" + }, + "termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions", + "title": "MongoDB Atlas Administration API", + "version": "2.0" + }, + "servers": [ + { + "url": "https://cloud.mongodb.com" + } + ], + "paths": { + "/api/atlas/v2": { + "get": { + "description": "This resource returns information about the MongoDB application along with API key meta data.", + "operationId": "getSystemStatus", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/SystemStatus" + }, + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiError" + } + } + }, + "description": "Unauthorized." + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "security": [ + { + "DigestAuth": [] + } + ], + "summary": "Return the status of this MongoDB application", + "tags": [ + "Root" + ], + "x-xgen-owner-team": "apix" + } + } + } +} diff --git a/plugins/openapi/testdata/mongodb-atlas-2025-02-18.json b/plugins/openapi/testdata/mongodb-atlas-2025-02-18.json new file mode 100644 index 0000000..562a265 --- /dev/null +++ b/plugins/openapi/testdata/mongodb-atlas-2025-02-18.json @@ -0,0 +1,314 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal:\n\n```\ncurl --user \"{PUBLIC-KEY}:{PRIVATE-KEY}\" \\\n --digest \\\n --header \"Accept: application/vnd.atlas.2043-01-01+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true\"\n```\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).\n\nYou can also explore the various endpoints available through the Atlas Administration API in MongoDB's [Postman workspace](https://www.postman.com/mongodb-devrel/workspace/mongodb-atlas-administration-apis/).", + "license": { + "name": "CC BY-NC-SA 3.0 US", + "url": "https://creativecommons.org/licenses/by-nc-sa/3.0/us/" + }, + "termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions", + "title": "MongoDB Atlas Administration API", + "version": "2.0", + "x-xgen-sha": "41da74ec79da4a8e39fd83a99bb8fa302e5c02d1" + }, + "servers": [ + { + "url": "https://cloud.mongodb.com" + } + ], + "paths": { + "/api/atlas/v2/users": { + "post": { + "description": "Creates one MongoDB Cloud user account. A MongoDB Cloud user account grants access to only the MongoDB Cloud application. To grant database access, create a database user. MongoDB Cloud sends an email to the users you specify, inviting them to join the project. Invited users don't have access to the project until they accept the invitation. Invitations expire after 30 days.\n\n MongoDB Cloud limits MongoDB Cloud user membership to a maximum of 250 MongoDB Cloud users per team. MongoDB Cloud limits MongoDB Cloud user membership to 500 MongoDB Cloud users per project and 500 MongoDB Cloud users per organization, which includes the combined membership of all projects in the organization. MongoDB Cloud raises an error if an operation exceeds these limits. For example, if you have an organization with five projects, and each project has 100 MongoDB Cloud users, and each MongoDB Cloud user belongs to only one project, you can't add any MongoDB Cloud users to this organization without first removing existing MongoDB Cloud users from the organization.\n\n To use this resource, the requesting API Key can have any role.", + "operationId": "createUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "requestBody": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + } + } + }, + "description": "MongoDB Cloud user account to create.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Create One MongoDB Cloud User", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/createUser", + "x-xgen-owner-team": "IAM" + } + }, + "/api/atlas/v2/users/byName/{userName}": { + "get": { + "description": "Returns the details for one MongoDB Cloud user account with the specified username. You can't use this endpoint to return information about an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. To use this resource, the requesting API Key can have any role.", + "operationId": "getUserByUsername", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "description": "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.", + "in": "path", + "name": "userName", + "required": true, + "schema": { + "pattern": "^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return One MongoDB Cloud User using Their Username", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUserByUsername", + "x-xgen-owner-team": "IAM" + }, + "x-xgen-IPA-exception": { + "xgen-IPA-102-path-alternate-resource-name-path-param": "API predates IPA validation" + } + }, + "/api/atlas/v2/users/{userId}": { + "get": { + "description": "Returns the details for one MongoDB Cloud user account with the specified unique identifier for the user. You can't use this endpoint to return information on an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. You can always retrieve your own user account. If you are the owner of a MongoDB Cloud organization or project, you can also retrieve the user profile for any user with membership in that organization or project. To use this resource, the requesting API Key can have any role.", + "operationId": "getUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "description": "Unique 24-hexadecimal digit string that identifies this user.", + "in": "path", + "name": "userId", + "required": true, + "schema": { + "pattern": "^([a-f0-9]{24})$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return One MongoDB Cloud User using Its ID", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUser", + "x-xgen-owner-team": "IAM" + } + }, + "/api/atlas/v2/orgs/{orgId}/users": { + "get": { + "description": "Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role.", + "operationId": "listOrganizationUsers", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/orgId" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "$ref": "#/components/parameters/includeCount" + }, + { + "$ref": "#/components/parameters/itemsPerPage" + }, + { + "$ref": "#/components/parameters/pageNum" + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/PaginatedAppUserView" + }, + "x-sunset": "2044-01-01", + "x-xgen-version": "2023-01-01" + }, + "application/vnd.atlas.2043-01-01+json": { + "schema": { + "$ref": "#/components/schemas/PaginatedOrgUserView" + }, + "x-xgen-hidden-env": { + "envs": "qa,stage,prod" + }, + "x-xgen-version": "2043-01-01" + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/badRequest" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return All MongoDB Cloud Users in One Organization", + "tags": [ + "Organizations" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Organizations/operation/listOrganizationUsers", + "x-xgen-owner-team": "IAM" + }, + "post": { + "description": "Invites one new or existing MongoDB Cloud user to join the organization. The invitation to join the organization will be sent to the username provided and must be accepted within 30 days. To use this resource, the requesting API Key must have the Organization Owner role.\n\n**Note**: If the user does not have an existing MongoDB Cloud account, they will be prompted to finish setting up an account upon accepting the invitation. If the user already has an account, they will still receive an invitation to access the organization.", + "operationId": "createOrganizationUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/orgId" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "requestBody": { + "content": { + "application/vnd.atlas.2043-01-01+json": { + "schema": { + "$ref": "#/components/schemas/OrgUserRequest" + } + } + }, + "description": "Represents the MongoDB Cloud user to be created within the organization.", + "required": true + }, + "responses": { + "201": { + "content": { + "application/vnd.atlas.2043-01-01+json": { + "schema": { + "$ref": "#/components/schemas/OrgUserResponse" + }, + "x-xgen-version": "2043-01-01" + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/badRequest" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "403": { + "$ref": "#/components/responses/forbidden" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "409": { + "$ref": "#/components/responses/conflict" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Add One MongoDB Cloud User to One Organization", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/createOrganizationUser", + "x-xgen-hidden-env": { + "envs": "qa,stage,prod" + }, + "x-xgen-owner-team": "IAM" + } + } + } +} diff --git a/plugins/openapi/testdata/mongodb-atlas-2025-02-20.json b/plugins/openapi/testdata/mongodb-atlas-2025-02-20.json new file mode 100644 index 0000000..ed0abea --- /dev/null +++ b/plugins/openapi/testdata/mongodb-atlas-2025-02-20.json @@ -0,0 +1,332 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal:\n\n```\ncurl --user \"{PUBLIC-KEY}:{PRIVATE-KEY}\" \\\n --digest \\\n --header \"Accept: application/vnd.atlas.2043-01-01+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true\"\n```\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).\n\nYou can also explore the various endpoints available through the Atlas Administration API in MongoDB's [Postman workspace](https://www.postman.com/mongodb-devrel/workspace/mongodb-atlas-administration-apis/).", + "license": { + "name": "CC BY-NC-SA 3.0 US", + "url": "https://creativecommons.org/licenses/by-nc-sa/3.0/us/" + }, + "termsOfService": "https://www.mongodb.com/mongodb-management-service-terms-and-conditions", + "title": "MongoDB Atlas Administration API", + "version": "2.0", + "x-xgen-sha": "252f0a9d10c85c536952b8d919ea5d54f054ec13" + }, + "servers": [ + { + "url": "https://cloud.mongodb.com" + } + ], + "paths": { + "/api/atlas/v2/users": { + "post": { + "deprecated": true, + "description": "Creates one MongoDB Cloud user account. A MongoDB Cloud user account grants access to only the MongoDB Cloud application. To grant database access, create a database user. MongoDB Cloud sends an email to the users you specify, inviting them to join the project. Invited users don't have access to the project until they accept the invitation. Invitations expire after 30 days.\n\n MongoDB Cloud limits MongoDB Cloud user membership to a maximum of 250 MongoDB Cloud users per team. MongoDB Cloud limits MongoDB Cloud user membership to 500 MongoDB Cloud users per project and 500 MongoDB Cloud users per organization, which includes the combined membership of all projects in the organization. MongoDB Cloud raises an error if an operation exceeds these limits. For example, if you have an organization with five projects, and each project has 100 MongoDB Cloud users, and each MongoDB Cloud user belongs to only one project, you can't add any MongoDB Cloud users to this organization without first removing existing MongoDB Cloud users from the organization.\n\n To use this resource, the requesting API Key can have any role.", + "operationId": "createUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "requestBody": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + } + } + }, + "description": "MongoDB Cloud user account to create.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-sunset": "2026-07-31", + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Create One MongoDB Cloud User", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/createUser", + "x-xgen-owner-team": "IAM" + } + }, + "/api/atlas/v2/users/byName/{userName}": { + "get": { + "deprecated": true, + "description": "Returns the details for one MongoDB Cloud user account with the specified username. You can't use this endpoint to return information about an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. To use this resource, the requesting API Key can have any role.", + "operationId": "getUserByUsername", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "description": "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.", + "in": "path", + "name": "userName", + "required": true, + "schema": { + "pattern": "^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-sunset": "2026-07-31", + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return One MongoDB Cloud User using Their Username", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUserByUsername", + "x-xgen-owner-team": "IAM" + }, + "x-xgen-IPA-exception": { + "xgen-IPA-102-path-alternate-resource-name-path-param": "API predates IPA validation" + } + }, + "/api/atlas/v2/users/{userId}": { + "get": { + "deprecated": true, + "description": "Returns the details for one MongoDB Cloud user account with the specified unique identifier for the user. You can't use this endpoint to return information on an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) API Key endpoint. You can always retrieve your own user account. If you are the owner of a MongoDB Cloud organization or project, you can also retrieve the user profile for any user with membership in that organization or project. To use this resource, the requesting API Key can have any role.", + "operationId": "getUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "description": "Unique 24-hexadecimal digit string that identifies this user.", + "in": "path", + "name": "userId", + "required": true, + "schema": { + "pattern": "^([a-f0-9]{24})$", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/CloudAppUser" + }, + "x-sunset": "2044-01-01", + "x-xgen-version": "2023-01-01" + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return One MongoDB Cloud User using Its ID", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/getUser", + "x-xgen-owner-team": "IAM" + } + }, + "/api/atlas/v2/orgs/{orgId}/users": { + "get": { + "description": "Returns details about the pending and active MongoDB Cloud users associated with the specified organization. To use this resource, the requesting API Key must have the Organization Member role.\n\n**Note**: This resource cannot be used to view details about users invited via the deprecated [Invite One MongoDB Cloud User to Join One Project](#tag/Projects/operation/createProjectInvitation) endpoint.\n\n**Note**: If using a deprecated version, only active users will be returned.", + "operationId": "listOrganizationUsers", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/orgId" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "$ref": "#/components/parameters/includeCount" + }, + { + "$ref": "#/components/parameters/itemsPerPage" + }, + { + "$ref": "#/components/parameters/pageNum" + }, + { + "description": "Email address to filter users by. Not supported in deprecated versions.", + "in": "query", + "name": "username", + "schema": { + "format": "email", + "type": "string" + } + }, + { + "description": "Organization membership status to filter users by. If you exclude this parameter, this resource returns both pending and active users. Not supported in deprecated versions.", + "in": "query", + "name": "orgMembershipStatus", + "schema": { + "example": "ACTIVE", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/vnd.atlas.2023-01-01+json": { + "schema": { + "$ref": "#/components/schemas/PaginatedAppUserView" + }, + "x-sunset": "2026-07-31", + "x-xgen-version": "2023-01-01" + }, + "application/vnd.atlas.2025-02-19+json": { + "schema": { + "$ref": "#/components/schemas/PaginatedOrgUserView" + }, + "x-xgen-version": "2025-02-19" + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/badRequest" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Return All MongoDB Cloud Users in One Organization", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/listOrganizationUsers", + "x-xgen-owner-team": "IAM" + }, + "post": { + "description": "Invites one new or existing MongoDB Cloud user to join the organization. The invitation to join the organization will be sent to the username provided and must be accepted within 30 days. To use this resource, the requesting API Key must have the Organization Owner role.\n\n**Note**: If the user does not have an existing MongoDB Cloud account, they will be prompted to finish setting up an account upon accepting the invitation. If the user already has an account, they will still receive an invitation to access the organization.", + "operationId": "createOrganizationUser", + "parameters": [ + { + "$ref": "#/components/parameters/envelope" + }, + { + "$ref": "#/components/parameters/orgId" + }, + { + "$ref": "#/components/parameters/pretty" + } + ], + "requestBody": { + "content": { + "application/vnd.atlas.2025-02-19+json": { + "schema": { + "$ref": "#/components/schemas/OrgUserRequest" + } + } + }, + "description": "Represents the MongoDB Cloud user to be created within the organization.", + "required": true + }, + "responses": { + "201": { + "content": { + "application/vnd.atlas.2025-02-19+json": { + "schema": { + "$ref": "#/components/schemas/OrgUserResponse" + }, + "x-xgen-version": "2025-02-19" + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/badRequest" + }, + "401": { + "$ref": "#/components/responses/unauthorized" + }, + "403": { + "$ref": "#/components/responses/forbidden" + }, + "404": { + "$ref": "#/components/responses/notFound" + }, + "409": { + "$ref": "#/components/responses/conflict" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Add One MongoDB Cloud User to One Organization", + "tags": [ + "MongoDB Cloud Users" + ], + "x-xgen-docs-url": "https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/MongoDB-Cloud-Users/operation/createOrganizationUser", + "x-xgen-owner-team": "IAM" + } + } + } +} diff --git a/plugins/openapi/testdata/openai-2026-10-27.yaml b/plugins/openapi/testdata/openai-2026-10-27.yaml new file mode 100644 index 0000000..9802edc --- /dev/null +++ b/plugins/openapi/testdata/openai-2026-10-27.yaml @@ -0,0 +1,801 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + identifier: MIT +servers: + - url: https://api.openai.com/v1 +paths: + /audio/translations: + post: + operationId: createTranslation + tags: + - Audio + summary: Create translation + description: Translates audio into English. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranslationRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/CreateTranslationResponseJson" + - $ref: "#/components/schemas/CreateTranslationResponseVerboseJson" + text/plain: + schema: + type: string + "400": + description: Invalid audio input or request parameters. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: Authentication failed because the API key is missing or revoked, or + the client IP is not authorized. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "403": + description: Access to a personal API organization is blocked by the + organization policy. + content: + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "413": + description: The audio request exceeds the supported size limit. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "429": + $ref: "#/components/responses/InferenceRateLimited" + "500": + description: The audio could not be processed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: The upstream audio service connection failed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + $ref: "#/components/responses/InferenceServiceUnavailable" + x-oaiMeta: + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/translations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/german.m4a" \ + -F model="whisper-1" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.translations.create( + model="whisper-1", + file=audio_file + ) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const translation = await openai.audio.translations.create({ + file: fs.createReadStream("speech.mp3"), + model: "whisper-1", + }); + + console.log(translation.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" + } + /audio/transcriptions: + post: + operationId: createTranscription + tags: + - Audio + summary: Create transcription + description: > + Transcribes audio into the input language. + + + Returns a transcription object in `json`, `diarized_json`, or + `verbose_json` + + format, plain text in `text`, `srt`, or `vtt` format, or a stream of + + transcript events. Supported formats depend on the model. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranscriptionRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/CreateTranscriptionResponseJson" + - $ref: "#/components/schemas/CreateTranscriptionResponseDiarizedJson" + - $ref: "#/components/schemas/CreateTranscriptionResponseVerboseJson" + text/plain: + schema: + type: string + text/event-stream: + schema: + $ref: "#/components/schemas/CreateTranscriptionResponseStreamEvent" + "400": + description: Invalid audio input or request parameters. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: Authentication failed because the API key is missing or revoked, or + the client IP is not authorized. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "403": + description: Access to a personal API organization is blocked by the + organization policy. + content: + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "413": + description: The audio request exceeds the supported size limit. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "429": + $ref: "#/components/responses/InferenceRateLimited" + "500": + description: The audio could not be processed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: The upstream audio service connection failed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + $ref: "#/components/responses/InferenceServiceUnavailable" + x-oaiMeta: + group: audio + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-transcribe" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + model="gpt-4o-transcribe", + file=audio_file + ) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "gpt-4o-transcribe", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Diarization + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/meeting.wav" \ + -F model="gpt-4o-transcribe-diarize" \ + -F response_format="diarized_json" \ + -F chunking_strategy=auto \ + -F 'known_speaker_names[]=agent' \ + -F 'known_speaker_references[]=data:audio/wav;base64,AAA...' + python: > + import base64 + + from openai import OpenAI + + + client = OpenAI() + + + def to_data_url(path: str) -> str: + with open(path, "rb") as fh: + return "data:audio/wav;base64," + base64.b64encode(fh.read()).decode("utf-8") + + with open("meeting.wav", "rb") as audio_file: + transcript = client.audio.transcriptions.create( + model="gpt-4o-transcribe-diarize", + file=audio_file, + response_format="diarized_json", + chunking_strategy="auto", + extra_body={ + "known_speaker_names": ["agent"], + "known_speaker_references": [to_data_url("agent.wav")], + }, + ) + + print(transcript.segments) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const speakerRef = + fs.readFileSync("agent.wav").toString("base64"); + + + const transcript = await openai.audio.transcriptions.create({ + file: fs.createReadStream("meeting.wav"), + model: "gpt-4o-transcribe-diarize", + response_format: "diarized_json", + chunking_strategy: "auto", + extra_body: { + known_speaker_names: ["agent"], + known_speaker_references: [`data:audio/wav;base64,${speakerRef}`], + }, + }); + + + console.log(transcript.segments); + response: > + { + "task": "transcribe", + "duration": 27.4, + "text": "Agent: Thanks for calling OpenAI support.\nA: Hi, I'm trying to enable diarization.\nAgent: Happy to walk you through the steps.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 4.7, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 4.7, + "end": 11.8, + "text": "Hi, I'm trying to enable diarization.", + "speaker": "A" + }, + { + "type": "transcript.text.segment", + "id": "seg_003", + "start": 12.1, + "end": 18.5, + "text": "Happy to walk you through the steps.", + "speaker": "agent" + } + ], + "usage": { + "type": "duration", + "seconds": 27 + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-mini-transcribe" \ + -F stream=true + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + stream = client.audio.transcriptions.create( + file=audio_file, + model="gpt-4o-mini-transcribe", + stream=True + ) + + for event in stream: + print(event) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const stream = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-mini-transcribe", + stream: true, + }); + + for await (const event of stream) { + console.log(event); + } + response: | + data: {"type":"transcript.text.delta","delta":"I","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]}]} + + data: {"type":"transcript.text.delta","delta":" see","logprobs":[{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]}]} + + data: {"type":"transcript.text.delta","delta":" skies","logprobs":[{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]}]} + + data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]}]} + + data: {"type":"transcript.text.delta","delta":" blue","logprobs":[{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]}]} + + data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]}]} + + data: {"type":"transcript.text.delta","delta":" clouds","logprobs":[{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]}]} + + data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]}]} + + data: {"type":"transcript.text.delta","delta":" white","logprobs":[{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0014890312,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]}]} + + data: {"type":"transcript.text.delta","delta":" bright","logprobs":[{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]}]} + + data: {"type":"transcript.text.delta","delta":" blessed","logprobs":[{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]}]} + + data: {"type":"transcript.text.delta","delta":" days","logprobs":[{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.00001700133,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]}]} + + data: {"type":"transcript.text.delta","delta":" dark","logprobs":[{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]}]} + + data: {"type":"transcript.text.delta","delta":" sacred","logprobs":[{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]}]} + + data: {"type":"transcript.text.delta","delta":" nights","logprobs":[{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0036910512,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]}]} + + data: {"type":"transcript.text.delta","delta":" I","logprobs":[{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]}]} + + data: {"type":"transcript.text.delta","delta":" think","logprobs":[{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]}]} + + data: {"type":"transcript.text.delta","delta":" to","logprobs":[{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]}]} + + data: {"type":"transcript.text.delta","delta":" myself","logprobs":[{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.29254505,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" what","logprobs":[{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]}]} + + data: {"type":"transcript.text.delta","delta":" a","logprobs":[{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]}]} + + data: {"type":"transcript.text.delta","delta":" wonderful","logprobs":[{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]}]} + + data: {"type":"transcript.text.delta","delta":" world","logprobs":[{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]}]} + + data: {"type":"transcript.text.delta","delta":".","logprobs":[{"token":".","logprob":-0.014231676,"bytes":[46]}]} + + data: {"type":"transcript.text.done","text":"I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]},{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]},{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]},{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]},{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]},{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]},{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]},{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]},{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]},{"token":",","logprob":-0.0014890312,"bytes":[44]},{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]},{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]},{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]},{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]},{"token":",","logprob":-0.00001700133,"bytes":[44]},{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]},{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]},{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]},{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]},{"token":",","logprob":-0.0036910512,"bytes":[44]},{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]},{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]},{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]},{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]},{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]},{"token":",","logprob":-0.29254505,"bytes":[44]},{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]},{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]},{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]},{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]},{"token":".","logprob":-0.014231676,"bytes":[46]}],"usage":{"input_tokens":14,"input_token_details":{"text_tokens":0,"audio_tokens":14},"output_tokens":45,"total_tokens":59}} + - title: Logprobs + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "include[]=logprobs" \ + -F model="gpt-4o-transcribe" \ + -F response_format="json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="gpt-4o-transcribe", + response_format="json", + include=["logprobs"] + ) + + print(transcript) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + response_format: "json", + include: ["logprobs"] + }); + + console.log(transcription); + } + + main(); + response: > + { + "text": "Hey, my knee is hurting and I want to see the doctor tomorrow ideally.", + "logprobs": [ + { "token": "Hey", "logprob": -1.0415299, "bytes": [72, 101, 121] }, + { "token": ",", "logprob": -9.805982e-5, "bytes": [44] }, + { "token": " my", "logprob": -0.00229799, "bytes": [32, 109, 121] }, + { + "token": " knee", + "logprob": -4.7159858e-5, + "bytes": [32, 107, 110, 101, 101] + }, + { "token": " is", "logprob": -0.043909557, "bytes": [32, 105, 115] }, + { + "token": " hurting", + "logprob": -1.1041146e-5, + "bytes": [32, 104, 117, 114, 116, 105, 110, 103] + }, + { "token": " and", "logprob": -0.011076359, "bytes": [32, 97, 110, 100] }, + { "token": " I", "logprob": -5.3193703e-6, "bytes": [32, 73] }, + { + "token": " want", + "logprob": -0.0017156356, + "bytes": [32, 119, 97, 110, 116] + }, + { "token": " to", "logprob": -7.89631e-7, "bytes": [32, 116, 111] }, + { "token": " see", "logprob": -5.5122365e-7, "bytes": [32, 115, 101, 101] }, + { "token": " the", "logprob": -0.0040786397, "bytes": [32, 116, 104, 101] }, + { + "token": " doctor", + "logprob": -2.3392786e-6, + "bytes": [32, 100, 111, 99, 116, 111, 114] + }, + { + "token": " tomorrow", + "logprob": -7.89631e-7, + "bytes": [32, 116, 111, 109, 111, 114, 114, 111, 119] + }, + { + "token": " ideally", + "logprob": -0.5800861, + "bytes": [32, 105, 100, 101, 97, 108, 108, 121] + }, + { "token": ".", "logprob": -0.00011093382, "bytes": [46] } + ], + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Word timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=word" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["word"] + ) + + print(transcript.words) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["word"] + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Word, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + response: | + { + "task": "transcribe", + "language": "english", + "duration": 0.5, + "text": "Hello.", + "words": [ + { + "word": "Hello", + "start": 0.0, + "end": 0.5 + } + ], + "usage": { + "type": "duration", + "seconds": 1 + } + } + - title: Segment timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=segment" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["segment"] + ) + + print(transcript.words) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["segment"] + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Segment, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "task": "transcribe", + "language": "english", + "duration": 3.32, + "text": "The beach was a popular spot on a hot summer day.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + } + ], + "usage": { + "type": "duration", + "seconds": 4 + } + } diff --git a/plugins/openapi/testdata/openai-2026-10-28.yaml b/plugins/openapi/testdata/openai-2026-10-28.yaml new file mode 100644 index 0000000..ea34adc --- /dev/null +++ b/plugins/openapi/testdata/openai-2026-10-28.yaml @@ -0,0 +1,877 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + identifier: MIT +servers: + - url: https://api.openai.com/v1 +paths: + /audio/translations: + post: + operationId: createTranslation + deprecated: true + tags: + - Audio + summary: Create translation + description: > + Translates audio into English. + + + This endpoint supports only `whisper-1`. The endpoint and model are + deprecated + + and scheduled to shut down on February 26, 2027. Migrate to + + `/v1/realtime/translations`, which requires a separate integration. See + the + + [deprecation + schedule](https://developers.openai.com/api/docs/deprecations) + + for details. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranslationRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/CreateTranslationResponseJson" + - $ref: "#/components/schemas/CreateTranslationResponseVerboseJson" + text/plain: + schema: + type: string + "400": + description: Invalid audio input or request parameters. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: Authentication failed because the API key is missing or revoked, or + the client IP is not authorized. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "403": + description: Access to a personal API organization is blocked by the + organization policy. + content: + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "413": + description: The audio request exceeds the supported size limit. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "429": + $ref: "#/components/responses/InferenceRateLimited" + "500": + description: The audio could not be processed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: The upstream audio service connection failed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + $ref: "#/components/responses/InferenceServiceUnavailable" + x-oaiMeta: + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/translations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/german.m4a" \ + -F model="whisper-1" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.translations.create( + model="whisper-1", + file=audio_file + ) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const translation = await openai.audio.translations.create({ + file: fs.createReadStream("speech.mp3"), + model: "whisper-1", + }); + + console.log(translation.text); + } + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" + } + /audio/transcriptions: + post: + operationId: createTranscription + tags: + - Audio + summary: Create transcription + description: > + Transcribes audio into the input language. + + + Returns a transcription object in `json`, `diarized_json`, or + `verbose_json` + + format, plain text in `text`, `srt`, or `vtt` format, or a stream of + + transcript events. Supported formats depend on the model. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranscriptionRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/CreateTranscriptionResponseJson" + - $ref: "#/components/schemas/CreateTranscriptionResponseDiarizedJson" + - $ref: "#/components/schemas/CreateTranscriptionResponseVerboseJson" + text/plain: + schema: + type: string + text/event-stream: + schema: + $ref: "#/components/schemas/CreateTranscriptionResponseStreamEvent" + "400": + description: Invalid audio input or request parameters. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: Authentication failed because the API key is missing or revoked, or + the client IP is not authorized. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "403": + description: Access to a personal API organization is blocked by the + organization policy. + content: + text/plain: + schema: + type: string + description: JSON-encoded error text containing an error object and the HTTP + status. + "413": + description: The audio request exceeds the supported size limit. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "429": + $ref: "#/components/responses/InferenceRateLimited" + "500": + description: The audio could not be processed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: The upstream audio service connection failed. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + $ref: "#/components/responses/InferenceServiceUnavailable" + x-oaiMeta: + group: audio + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-transcribe" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + model="gpt-4o-transcribe", + file=audio_file + ) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "gpt-4o-transcribe", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Diarization + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/meeting.wav" \ + -F model="gpt-4o-transcribe-diarize" \ + -F response_format="diarized_json" \ + -F chunking_strategy=auto \ + -F 'known_speaker_names[]=agent' \ + -F 'known_speaker_references[]=data:audio/wav;base64,AAA...' + python: > + import base64 + + from openai import OpenAI + + + client = OpenAI() + + + def to_data_url(path: str) -> str: + with open(path, "rb") as fh: + return "data:audio/wav;base64," + base64.b64encode(fh.read()).decode("utf-8") + + with open("meeting.wav", "rb") as audio_file: + transcript = client.audio.transcriptions.create( + model="gpt-4o-transcribe-diarize", + file=audio_file, + response_format="diarized_json", + chunking_strategy="auto", + extra_body={ + "known_speaker_names": ["agent"], + "known_speaker_references": [to_data_url("agent.wav")], + }, + ) + + print(transcript.segments) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const speakerRef = + fs.readFileSync("agent.wav").toString("base64"); + + + const transcript = await openai.audio.transcriptions.create({ + file: fs.createReadStream("meeting.wav"), + model: "gpt-4o-transcribe-diarize", + response_format: "diarized_json", + chunking_strategy: "auto", + extra_body: { + known_speaker_names: ["agent"], + known_speaker_references: [`data:audio/wav;base64,${speakerRef}`], + }, + }); + + + console.log(transcript.segments); + response: > + { + "task": "transcribe", + "duration": 27.4, + "text": "Agent: Thanks for calling OpenAI support.\nA: Hi, I'm trying to enable diarization.\nAgent: Happy to walk you through the steps.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 4.7, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 4.7, + "end": 11.8, + "text": "Hi, I'm trying to enable diarization.", + "speaker": "A" + }, + { + "type": "transcript.text.segment", + "id": "seg_003", + "start": 12.1, + "end": 18.5, + "text": "Happy to walk you through the steps.", + "speaker": "agent" + } + ], + "usage": { + "type": "duration", + "seconds": 27 + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="gpt-4o-mini-transcribe" \ + -F stream=true + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + stream = client.audio.transcriptions.create( + file=audio_file, + model="gpt-4o-mini-transcribe", + stream=True + ) + + for event in stream: + print(event) + javascript: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const stream = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-mini-transcribe", + stream: true, + }); + + for await (const event of stream) { + console.log(event); + } + response: | + data: {"type":"transcript.text.delta","delta":"I","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]}]} + + data: {"type":"transcript.text.delta","delta":" see","logprobs":[{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]}]} + + data: {"type":"transcript.text.delta","delta":" skies","logprobs":[{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]}]} + + data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]}]} + + data: {"type":"transcript.text.delta","delta":" blue","logprobs":[{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]}]} + + data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]}]} + + data: {"type":"transcript.text.delta","delta":" clouds","logprobs":[{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]}]} + + data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]}]} + + data: {"type":"transcript.text.delta","delta":" white","logprobs":[{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0014890312,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]}]} + + data: {"type":"transcript.text.delta","delta":" bright","logprobs":[{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]}]} + + data: {"type":"transcript.text.delta","delta":" blessed","logprobs":[{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]}]} + + data: {"type":"transcript.text.delta","delta":" days","logprobs":[{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.00001700133,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]}]} + + data: {"type":"transcript.text.delta","delta":" dark","logprobs":[{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]}]} + + data: {"type":"transcript.text.delta","delta":" sacred","logprobs":[{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]}]} + + data: {"type":"transcript.text.delta","delta":" nights","logprobs":[{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0036910512,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]}]} + + data: {"type":"transcript.text.delta","delta":" I","logprobs":[{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]}]} + + data: {"type":"transcript.text.delta","delta":" think","logprobs":[{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]}]} + + data: {"type":"transcript.text.delta","delta":" to","logprobs":[{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]}]} + + data: {"type":"transcript.text.delta","delta":" myself","logprobs":[{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]}]} + + data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.29254505,"bytes":[44]}]} + + data: {"type":"transcript.text.delta","delta":" what","logprobs":[{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]}]} + + data: {"type":"transcript.text.delta","delta":" a","logprobs":[{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]}]} + + data: {"type":"transcript.text.delta","delta":" wonderful","logprobs":[{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]}]} + + data: {"type":"transcript.text.delta","delta":" world","logprobs":[{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]}]} + + data: {"type":"transcript.text.delta","delta":".","logprobs":[{"token":".","logprob":-0.014231676,"bytes":[46]}]} + + data: {"type":"transcript.text.done","text":"I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]},{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]},{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]},{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]},{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]},{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]},{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]},{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]},{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]},{"token":",","logprob":-0.0014890312,"bytes":[44]},{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]},{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]},{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]},{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]},{"token":",","logprob":-0.00001700133,"bytes":[44]},{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]},{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]},{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]},{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]},{"token":",","logprob":-0.0036910512,"bytes":[44]},{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]},{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]},{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]},{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]},{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]},{"token":",","logprob":-0.29254505,"bytes":[44]},{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]},{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]},{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]},{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]},{"token":".","logprob":-0.014231676,"bytes":[46]}],"usage":{"input_tokens":14,"input_token_details":{"text_tokens":0,"audio_tokens":14},"output_tokens":45,"total_tokens":59}} + - title: Logprobs + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "include[]=logprobs" \ + -F model="gpt-4o-transcribe" \ + -F response_format="json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="gpt-4o-transcribe", + response_format="json", + include=["logprobs"] + ) + + print(transcript) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "gpt-4o-transcribe", + response_format: "json", + include: ["logprobs"] + }); + + console.log(transcription); + } + + main(); + response: > + { + "text": "Hey, my knee is hurting and I want to see the doctor tomorrow ideally.", + "logprobs": [ + { "token": "Hey", "logprob": -1.0415299, "bytes": [72, 101, 121] }, + { "token": ",", "logprob": -9.805982e-5, "bytes": [44] }, + { "token": " my", "logprob": -0.00229799, "bytes": [32, 109, 121] }, + { + "token": " knee", + "logprob": -4.7159858e-5, + "bytes": [32, 107, 110, 101, 101] + }, + { "token": " is", "logprob": -0.043909557, "bytes": [32, 105, 115] }, + { + "token": " hurting", + "logprob": -1.1041146e-5, + "bytes": [32, 104, 117, 114, 116, 105, 110, 103] + }, + { "token": " and", "logprob": -0.011076359, "bytes": [32, 97, 110, 100] }, + { "token": " I", "logprob": -5.3193703e-6, "bytes": [32, 73] }, + { + "token": " want", + "logprob": -0.0017156356, + "bytes": [32, 119, 97, 110, 116] + }, + { "token": " to", "logprob": -7.89631e-7, "bytes": [32, 116, 111] }, + { "token": " see", "logprob": -5.5122365e-7, "bytes": [32, 115, 101, 101] }, + { "token": " the", "logprob": -0.0040786397, "bytes": [32, 116, 104, 101] }, + { + "token": " doctor", + "logprob": -2.3392786e-6, + "bytes": [32, 100, 111, 99, 116, 111, 114] + }, + { + "token": " tomorrow", + "logprob": -7.89631e-7, + "bytes": [32, 116, 111, 109, 111, 114, 114, 111, 119] + }, + { + "token": " ideally", + "logprob": -0.5800861, + "bytes": [32, 105, 100, 101, 97, 108, 108, 121] + }, + { "token": ".", "logprob": -0.00011093382, "bytes": [46] } + ], + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 14 + }, + "output_tokens": 45, + "total_tokens": 59 + } + } + - title: Word timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=word" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["word"] + ) + + print(transcript.words) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["word"] + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Word, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + response: | + { + "task": "transcribe", + "language": "english", + "duration": 0.5, + "text": "Hello.", + "words": [ + { + "word": "Hello", + "start": 0.0, + "end": 0.5 + } + ], + "usage": { + "type": "duration", + "seconds": 1 + } + } + - title: Segment timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=segment" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["segment"] + ) + + print(transcript.words) + javascript: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["segment"] + }); + + console.log(transcription.text); + } + + main(); + csharp: > + using System; + + + using OpenAI.Audio; + + + string audioFilePath = "audio.mp3"; + + + AudioClient client = new( + model: "whisper-1", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + AudioTranscriptionOptions options = new() + + { + ResponseFormat = AudioTranscriptionFormat.Verbose, + TimestampGranularities = AudioTimestampGranularities.Segment, + }; + + + AudioTranscription transcription = + client.TranscribeAudio(audioFilePath, options); + + + Console.WriteLine($"{transcription.Text}"); + response: > + { + "task": "transcribe", + "language": "english", + "duration": 3.32, + "text": "The beach was a popular spot on a hot summer day.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + } + ], + "usage": { + "type": "duration", + "seconds": 4 + } + } + /organization/external_keys: + post: + summary: Add an external key config for an organization + description: Add an external key config for an organization + operationId: Addanexternalkeyconfigforanorganization + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V1OrganizationExternalKeysPostRequest" + required: true + responses: + "200": + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/ExternalKeyResource" + security: + - AdminApiKeyAuth: [] + get: + summary: List the external key configs registered on the user's organization + description: List the external key configs registered on the user's organization + operationId: Listtheexternalkeyconfigsregisteredontheuser'sorganization + parameters: + - name: limit + in: query + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - name: order + in: query + required: false + schema: + $ref: "#/components/schemas/OrderEnum" + - name: after + in: query + required: false + schema: + anyOf: + - type: string + - type: "null" + - name: purpose + in: query + description: Filter by key purpose. When omitted, returns keys of all purposes. + required: false + schema: + $ref: "#/components/schemas/ExternalKeyPurpose" + responses: + "200": + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/ListExternalKeysResource" + security: + - AdminApiKeyAuth: [] diff --git a/plugins/openapi/testdata/openai-2026-11-17.yaml b/plugins/openapi/testdata/openai-2026-11-17.yaml new file mode 100644 index 0000000..886f03c --- /dev/null +++ b/plugins/openapi/testdata/openai-2026-11-17.yaml @@ -0,0 +1,84 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + identifier: MIT +servers: + - url: https://api.openai.com/v1 +components: + schemas: + SessionBudgetControlParams: + type: object + properties: + limit: + type: + - integer + - "null" + format: int64 + minimum: 1 + maximum: 4503599627370495 + description: Positive USD cents, or null to remove the limit. + required: + - limit + additionalProperties: false + description: Sets the session-wide limit without changing recorded spend. + SessionBudgetControlResource: + type: object + properties: + limit: + type: + - integer + - "null" + format: int64 + minimum: 1 + maximum: 4503599627370495 + description: The configured positive limit in USD cents, or null when unlimited. + consumed: + type: + - integer + - "null" + minimum: 0 + description: Best-effort recorded spend floored to whole USD cents, or null when + unavailable. + required: + - limit + - consumed + additionalProperties: false + description: Session-wide spending limit and best-effort consumption, including + unlimited sessions. + SessionEventAgentSessionBudgetReached: + type: object + properties: + type: + type: string + enum: + - agent.session.budget_reached + default: agent.session.budget_reached + x-stainless-const: true + description: The type of the object. Always `agent.session.budget_reached`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session: + $ref: "#/components/schemas/SessionResource" + description: The paused session. + obfuscation: + type: string + minLength: 0 + description: Random alphanumeric padding. Present when stream obfuscation is + enabled. + required: + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session pauses because its spending limit was reached. diff --git a/plugins/openapi/testdata/openai-2026-11-18.yaml b/plugins/openapi/testdata/openai-2026-11-18.yaml new file mode 100644 index 0000000..900273a --- /dev/null +++ b/plugins/openapi/testdata/openai-2026-11-18.yaml @@ -0,0 +1,17 @@ +openapi: 3.1.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + identifier: MIT +servers: + - url: https://api.openai.com/v1 +components: + schemas: diff --git a/providers/appwrite.md b/providers/appwrite.md index 0d5e8e2..8d08aee 100644 --- a/providers/appwrite.md +++ b/providers/appwrite.md @@ -45,6 +45,6 @@ Kind: `openapi` (`plugins/openapi`), with `adapter.Appwrite`. - **Removals aren't events.** The spec doesn't mark them first, so real ones are missed. The SDK changelogs say them ("* Breaking: removed `X`"); a `changelog` plugin per SDK could read them. - **Deprecations from before the plugin's first run aren't events,** nor operations that first appear already flagged. When the newest minor changes, the plugin diffs the new directory against the previous minor's last spec, so an operation that was unflagged there and is flagged in the new one is an event. The Databases to TablesDB deprecations of 1.8.0 can be replayed (`1.7.x@` to ``), and a run never sees them. - **The layout changed once (2.0.x) and may again.** The adapter fails, rather than guess, when a directory has neither file. -- **Spec commits aren't releases.** A deprecation's `version` is the day the spec changed, which can trail the release. Two commits on one day share a `version`. +- **Spec commits aren't releases.** A deprecation's `version` is the day the spec changed, which can trail the release. Two commits on one day are one version, read at the day's last commit. - **Client and console operations aren't watched.** Only what a server SDK can call. - **The patch-it client needs `appwrite` in its list of date-versioned APIs,** as for `neon`, `convex` and `planetscale`. Without it, it reads the date as a package version and drops the event. diff --git a/providers/cloudflare-api-spec.md b/providers/cloudflare-api-spec.md new file mode 100644 index 0000000..fb03c14 --- /dev/null +++ b/providers/cloudflare-api-spec.md @@ -0,0 +1,45 @@ +# Cloudflare (`cloudflare/api-spec`) + +## What it watches + +The Cloudflare API (`api.cloudflare.com/client/v4`): operations Cloudflare marks deprecated, and removals of operations it had marked deprecated, day by day in the OpenAPI spec its SDKs and Terraform provider are generated from. + +Kind: `openapi` (`plugins/openapi`), with `adapter.Cloudflare`. (`cloudflare/api` is Cloudflare's deprecations feed, read by the `notices` kind.) + +## Why this source + +- **Source:** `openapi.json` in [cloudflare/api-schemas](https://github.com/cloudflare/api-schemas) (BSD-3-Clause), pinned to a commit (`https://raw.githubusercontent.com/cloudflare/api-schemas//openapi.json`). The versions come from the GitHub commits API. Checked on 2026-11-21. +- **Why this one:** + - It's Cloudflare's own description of the whole API, published by a bot several times a day ("Update schema: openapi.json"), the input to `cloudflare-python`, `cloudflare-typescript` and the Terraform provider. + - It marks deprecated operations with the `deprecated` flag, and most carry `x-stainless-deprecation-message` with the end-of-life date. + - Every commit can be cited and replayed. +- **Alternatives considered:** + - **`openapi.yaml` beside it:** the same spec as YAML. + - **The [API deprecations page](https://developers.cloudflare.com/fundamentals/api/reference/deprecations/)** and its feed: read by `cloudflare/api` (kind `notices`). It announces end-of-life dates in prose; the spec says which operation, and when it's gone. + - **The changelog:** product news, not keyed by operation. +- **Quote:** "This operation is deprecated and will reach end of life on September 27, 2026. Use the new Registrar API endpoints (domain-search, domain-check, registrations) instead." (`GET /accounts/{account_id}/registrar/domains`, removed from the spec on 2026-10-30) + +## How the provider announces changes + +- **One version per day.** The spec is committed several times a day, there are no tags, and `info.version` is a fixed `4.0.0`, so a version is a day: the day's last commit, its date the event's `version`. +- **Operations are named by the path a caller sends** (`GET /client/v4/accounts/…`): the server is `https://api.cloudflare.com/client/v4`, moved into the paths. +- **Deprecations use the flag** (329 operations on 2026-11-20) **or the summary** (11 more, written "List datasets (deprecated)" or "Deprecated: Retrieve legacy embed code HTML"). Other uses of "deprecated" in summaries and descriptions are about a parameter or a model. +- **Path parameters get renamed** (`{zone_identifier}` to `{zone_id}` on 2026-10-30) without the URL changing. +- **Operations leave the spec without notice too:** POST `/accounts/move` and the `/tenants/{tenant_id}` operations on 2026-10-30, never marked. + +## What the plugin reads and ignores + +- **Reads** every day's spec, diffed against the day before. Two events come out of it: + - **Deprecations:** an operation that gains the flag or a summary saying so. A flagged one quotes the whole operation (its deprecation message included). + - **Removals (breaking):** an operation that leaves the spec after the previous day's spec had marked it deprecated. +- **Matches operations by path template,** so a renamed path parameter isn't a removal. +- **Ignores everything else:** removals of operations never marked deprecated, schema and property changes (mostly the generator's), new operations. +- **The golden test** replays 2026-10-29 → 2026-10-30: the three deprecated Registrar domains operations removed, three events. The drop test is the same pair: POST `/accounts/move` and GET `/tenants/{tenant_id}`, gone unmarked, make none. + +## Known gaps + +- **Deprecated parameters and fields** aren't events: only whole operations are. +- **Removals Cloudflare didn't mark first aren't events.** +- **History:** the GitHub commits API lists at most 1,000 commits, about five months of this spec (back to 2026-06-11 on 2026-11-21); older days aren't listed. +- **Size:** each version is a 30 MB download. +- **The patch-it client needs `cloudflare` in its list of date-versioned APIs** to place the events' date `version`; that list is outside this repo. diff --git a/providers/convex.md b/providers/convex.md index 1aced5f..edad942 100644 --- a/providers/convex.md +++ b/providers/convex.md @@ -44,5 +44,5 @@ Kind: `openapi` (`plugins/openapi`), with `adapter.Convex`. - **Only the Deployment API is covered.** Not the Management API (see above), the client SDKs (`convex` on npm, `convex-py`), or the functions runtime. SDK removals are written as plain bullets in their changelogs, so nothing reads them yet. - **Removals Convex doesn't mark first aren't events,** even if the endpoint really went away. None has happened yet. -- **Two spec commits on one day share a `version`.** It happened on 13 days in the history. The events stay distinct, because the operation is part of the fingerprint, but the second run's `previous_version` equals its `version`. +- **Two spec commits on one day are one version** (13 days in the history), read at the day's last commit: a change made and undone the same day isn't seen. - **The patch-it client can't place these events until `convex` is in its list of date-versioned APIs.** diff --git a/providers/mongodb-atlas-admin-spec.md b/providers/mongodb-atlas-admin-spec.md new file mode 100644 index 0000000..5a5ef5b --- /dev/null +++ b/providers/mongodb-atlas-admin-spec.md @@ -0,0 +1,42 @@ +# MongoDB (`mongodb/atlas-admin-spec`) + +## What it watches + +The MongoDB Atlas Administration API v2 (`cloud.mongodb.com/api/atlas/v2`): operations MongoDB marks deprecated, and removals of operations it had marked deprecated, day by day in the OpenAPI spec MongoDB publishes for it. + +Kind: `openapi` (`plugins/openapi`), with `adapter.MongoDBAtlas`. The API's own changelog is a separate source, `mongodb/atlas-admin-api` (kind `changelog`). + +## Why this source + +- **Source:** `openapi/v2.json` in [mongodb/openapi](https://github.com/mongodb/openapi), pinned to a commit (`https://raw.githubusercontent.com/mongodb/openapi//openapi/v2.json`). The versions come from the GitHub commits API. Checked on 2026-11-21. +- **Why this one:** + - It's MongoDB's own spec of the whole API, committed by its release workflow ("ci(prod): Release OpenAPI Spec") a few times a week: 768 commits from 2024-07-25 to 2026-11-19. + - It marks deprecated operations with the `deprecated` flag. + - Every commit can be cited and replayed. +- **Alternatives considered:** + - **The repo's `v0.0.N` tags:** they mark the repo's tooling releases, not the spec. + - **The per-resource-version files in `openapi/v2/`:** one file per API resource version; `v2.json` holds every operation with all its versions, which is what a caller of any version sees removed. + - **`changelog/changelog.json`:** read by `mongodb/atlas-admin-api`; it reports changes per resource version, in prose, not removals of whole operations. +- **Quote:** `"deprecated": true` on `GET /api/atlas/v2/users/byName/{userName}` ("Returns the details for one MongoDB Cloud user account with the specified username."), new on 2025-02-20. + +## How the provider announces changes + +- **One version per day,** the day's last commit, its date the event's `version`: `info.version` is a fixed `2.0`, and the dated resource versions (`application/vnd.atlas.2025-03-12+json`) are per operation, several in one spec. +- **Deprecations use the flag** (53 operations on 2026-11-19). Fourteen descriptions mention "deprecated" without it, each about the deprecated invitation flow, not the operation. +- **Deprecated operations do leave:** the tenant backup operations were flagged, then removed between 2025-10 and 2026-11. +- **Operations also leave unmarked:** GET `/rest/unauth/version` on 2024-08-07. + +## What the plugin reads and ignores + +- **Reads** every day's spec, diffed against the day before. Two events come out of it: + - **Deprecations:** an operation that gains the `deprecated` flag, quoting the whole operation. + - **Removals (breaking):** an operation that leaves the spec after the previous day's spec had marked it deprecated. +- **Ignores everything else:** removals of operations never marked deprecated, schema and property changes (the changelog source reports those per resource version), new operations. +- **The golden test** replays 2025-02-18 → 2025-02-20, when 14 user-management operations were deprecated at once; three are saved, three events. **The drop test** replays 2024-07-25 → 2024-08-07: GET `/rest/unauth/version` gone unmarked, no event. + +## Known gaps + +- **Deprecated resource versions** (an operation's `2023-01-01` content type sunset while newer ones stay) aren't events: only whole operations are. The changelog source covers them. +- **Removals MongoDB didn't flag first aren't events.** +- **History starts on 2024-07-25,** when `openapi/v2.json` was first committed. +- **License:** the spec is CC BY-NC-SA 3.0 US; only small excerpts are saved for tests. diff --git a/providers/neon.md b/providers/neon.md index 91ffd93..e6e03b1 100644 --- a/providers/neon.md +++ b/providers/neon.md @@ -50,5 +50,5 @@ Kind: `openapi` (`plugins/openapi`), with `adapter.Neon`. - **Lag.** neon-pkgs commits the spec when someone acts on the drift check, days after the live spec changes. On 2026-11-19 the live spec had one operation more than the newest commit. - **History before 2026-06-24** isn't in neon-pkgs, so deprecations and removals before then (`GET /consumption_history/account`, removed by 2026-06-19) aren't replayable from this source. - **Only the management API is covered,** not the serverless driver (`@neondatabase/serverless`) or the Data API. -- **Two spec commits on one day would share a `version`.** It hasn't happened in the history. +- **Two spec commits on one day are one version,** read at the day's last commit: the event's `version` is a day. - **The patch-it client needs `neon` in its list of date-versioned APIs.** The events' `version` is a date (`2026-08-23`), because the API has no version; without the entry, the client reads it as a package version and can't place these events. That list is in the client used by patch-it's hosted ingestion service, not in this repo. diff --git a/providers/openai-api.md b/providers/openai-api.md new file mode 100644 index 0000000..decae74 --- /dev/null +++ b/providers/openai-api.md @@ -0,0 +1,44 @@ +# OpenAI (`openai/api`) + +## What it watches + +The OpenAI REST API (`api.openai.com/v1`): operations OpenAI marks deprecated, and removals of operations it had marked deprecated, day by day in the OpenAPI spec its SDKs are generated from. + +Kind: `openapi` (`plugins/openapi`), with `adapter.OpenAI`. + +## Why this source + +- **Source:** `openapi.yaml` in [openai/openai-openapi](https://github.com/openai/openai-openapi) (MIT), pinned to a commit (`https://raw.githubusercontent.com/openai/openai-openapi//openapi.yaml`). The versions come from the GitHub commits API. Checked on 2026-11-21. +- **Why this one:** + - It's OpenAI's own description of the API, the one `openai-python` and `openai-node` are generated from, and it's kept current: 589 commits changed it from 2022-01-19 to 2026-11-21, several on most days. + - It marks deprecated operations with the `deprecated` flag, and the operation's description says until when. + - Every commit can be cited and replayed. +- **Alternatives considered:** + - **The repo's tags** (`1.3.0`, `2.0.0`): too sparse to follow the API. + - **`openapi.json` beside it:** the same spec, but only committed from 2026-07-16 on; the YAML has the whole history. + - **The [deprecations page](https://developers.openai.com/api/docs/deprecations):** read for model shutdowns by `openai/models` (kind `notices`). It announces endpoint shutdowns in prose and tables, not per operation. + - **The changelog:** product news, not keyed by operation. +- **Quote:** "The endpoint and model are deprecated and scheduled to shut down on February 26, 2027." (`POST /audio/translations`, flagged deprecated on 2026-10-28) + +## How the provider announces changes + +- **One version per day.** The spec is committed several times a day, and `info.version` (`2.3.0`) isn't bumped with each change, so a version is a day: the day's last commit, its date the event's `version`. +- **Operations are named by the path a caller sends** (`POST /v1/audio/translations`): the server is `https://api.openai.com/v1` and the paths leave out `/v1`, so the adapter moves it into the paths. +- **Deprecations use the flag.** On 2026-11-21, 17 operations carry it, and none is called deprecated only in words (one description mentions deprecated models, not the operation). Flagged descriptions give the shutdown date. +- **Much of the daily churn is the spec's own shape**: enum lists rewritten as `const`, schemas regenerated, work in progress added and pulled again. + +## What the plugin reads and ignores + +- **Reads** every day's spec, diffed against the day before. Two events come out of it: + - **Deprecations:** an operation that gains the `deprecated` flag. The event quotes the whole operation, so the shutdown date is in the excerpt. + - **Removals (breaking):** an operation that leaves the spec after the previous day's spec had marked it deprecated. +- **Matches operations by path template,** so a renamed path parameter isn't a removal. +- **Ignores everything else:** removals of operations that were never deprecated, schema and property changes, new operations. The drop test replays 2026-11-17 → 2026-11-18, when the session spending-limit schemas added the day before were pulled again: three schema removals, no event. +- **The golden test** replays 2026-10-27 → 2026-10-28: `POST /audio/translations` deprecated, one event; the two new `/organization/external_keys` operations of the same day are dropped. + +## Known gaps + +- **Deprecated parameters, fields and enum values** (`user` in favor of `safety_identifier`, a model in a `model` enum) aren't events: only whole operations are. +- **Removals OpenAI didn't flag first aren't events,** even if the endpoint really went away. +- **History:** the GitHub commits API lists at most 1,000 commits. The spec has 589 (back to 2022-01-19), so all are listed today; at its pace, the oldest will start dropping off in 2027. +- **The patch-it client needs `openai` in its list of date-versioned APIs** to place the events' date `version`; that list is outside this repo. diff --git a/providers/planetscale.md b/providers/planetscale.md index 9a54a6f..e4aabd1 100644 --- a/providers/planetscale.md +++ b/providers/planetscale.md @@ -49,5 +49,5 @@ Kind: `openapi` (`plugins/openapi`), with `adapter.PlanetScale`. - **The repo lags the live spec.** A change arrives when the Monday pull request is merged, not when PlanetScale publishes it: on 2026-11-19 the live spec had 7 operations the repo's newest copy (2026-11-09) didn't, and the history has a three-month gap (2026-02-26 to 2026-06-01). The event's `version` is the commit date, not the day PlanetScale changed the API. - **Some commits are hand edits** to the copy ("Fix type of `planetscale_organization` `invoice_budget_amount`", "Mark `parent_branch` as optional"), so a version can differ from what PlanetScale published. Only 13 of the 33 commits are the workflow's own. - **Only the REST API is covered.** The SDKs and drivers aren't: `@planetscale/database` (database-js) 2.0.0 (2026-09-24) removed parameter interpolation, which this plugin can't see. -- **Two spec commits on one day share a `version`** (it happened on 2025-12-04, 2026-02-24, 2026-08-11 and 2026-09-10). The events stay distinct, because the operation is part of the fingerprint, but the second run's `previous_version` equals its `version`. +- **Two spec commits on one day are one version** (2025-12-04, 2026-02-24, 2026-08-11 and 2026-09-10 in the history), read at the day's last commit: a change made and undone the same day isn't seen. - **The patch-it client can't place these events yet.** Their `version` is a date (`2026-11-09`), because the API has no version. The client keeps a date-versioned API's events only if the API is in its list of date-versioned APIs, so `planetscale` needs an entry there. diff --git a/providers/supabase.md b/providers/supabase.md index 70e8387..34d7169 100644 --- a/providers/supabase.md +++ b/providers/supabase.md @@ -42,5 +42,5 @@ Kind: `openapi` (`plugins/openapi`), with `adapter.Supabase`. - **A shutdown said only in words isn't an event.** On 2026-09-30 the `logs.all` description became "This endpoint has been removed and always responds with `410 Gone`", but the operation stayed in the spec. The diff sees no structural change. - **Removals Supabase didn't mark first aren't events,** even if the endpoint really went away. - **Only the Management API is covered.** The APIs most apps call (the Data API through PostgREST, Auth, Storage, Realtime) and the SDKs are not. -- **Two spec commits on one day share a `version`.** It happened on four days in the history. The events stay distinct, because the operation is part of the fingerprint, but the second run's `previous_version` equals its `version`. +- **Two spec commits on one day are one version** (four days in the history), read at the day's last commit: a change made and undone the same day isn't seen. - **The patch-it client can't place these events yet.** Their `version` is a date (`2026-06-29`), because the API has no version. The client's version check reads an `api_operation` version as a package version, so it needs the same rule for date-versioned API events that `cloudflare`'s need.