diff --git a/adapter/algolia.go b/adapter/algolia.go new file mode 100644 index 0000000..dcb18d0 --- /dev/null +++ b/adapter/algolia.go @@ -0,0 +1,134 @@ +package adapter + +import ( + "context" + "encoding/json" + "fmt" + "regexp" + "strings" + "time" + + "github.com/patch-it-dev/patch-it-plugins/fetch" + "gopkg.in/yaml.v3" +) + +// Variables, not constants, only so tests can point them at a local server. +var ( + // algoliaRefsURL lists every release tag of algolia/api-clients-automation, + // "released-2026-11-17-31c309fe2a" (or "released-2023-08-22" before + // 2024): the date, then the commit. + algoliaRefsURL = "https://api.github.com/repos/algolia/api-clients-automation/git/matching-refs/tags/released-" + // algoliaCommitURL is one tag's commit, for its date. + algoliaCommitURL = "https://api.github.com/repos/algolia/api-clients-automation/commits/%s" + // algoliaSpecURLTemplate is one API's bundled spec at one release tag: the + // spec Algolia generates its API clients from. + algoliaSpecURLTemplate = "https://raw.githubusercontent.com/algolia/api-clients-automation/%s/specs/bundled/%s.yml" +) + +// Algolia adapts one of Algolia's REST API specs (Spec: "search", +// "ingestion", "recommend") in algolia/api-clients-automation for the openapi +// plugin, release by release. +type Algolia struct { + Spec string +} + +var _ Adapter = Algolia{} + +func (a Algolia) API() string { return "algolia-" + a.Spec } + +var algoliaTag = regexp.MustCompile(`^released-(\d{4}-\d{2}-\d{2})(-[0-9a-f]+)?$`) + +// LatestTag is the newest release tag. The name sorts by day, but a day can +// have several releases (three on 2024-09-19) whose commit suffix says +// nothing about their order, so those are told apart by their commit's date. +func (a Algolia) LatestTag(ctx context.Context) (string, error) { + body, err := fetch.Get(ctx, algoliaRefsURL, githubHeaders()) + if err != nil { + return "", fmt.Errorf("listing algolia's release tags: %w", err) + } + var refs []struct { + Ref string `json:"ref"` + } + if err := json.Unmarshal(body, &refs); err != nil { + return "", fmt.Errorf("parsing github's tag refs: %w", err) + } + var day string + var sameDay []string + for _, r := range refs { + tag := strings.TrimPrefix(r.Ref, "refs/tags/") + m := algoliaTag.FindStringSubmatch(tag) + switch { + case m == nil: + continue + case m[1] > day: + day, sameDay = m[1], []string{tag} + case m[1] == day: + sameDay = append(sameDay, tag) + } + } + if len(sameDay) == 0 { + return "", fmt.Errorf("github lists no algolia release tag") + } + if len(sameDay) == 1 { + return sameDay[0], nil + } + var latest string + var latestAt time.Time + for _, tag := range sameDay { + at, err := algoliaCommitDate(ctx, tag) + if err != nil { + return "", err + } + if at.After(latestAt) { + latest, latestAt = tag, at + } + } + return latest, nil +} + +func algoliaCommitDate(ctx context.Context, tag string) (time.Time, error) { + body, err := fetch.Get(ctx, fmt.Sprintf(algoliaCommitURL, tag), githubHeaders()) + if err != nil { + return time.Time{}, fmt.Errorf("looking up algolia tag %s: %w", tag, err) + } + var c struct { + Commit struct { + Committer struct { + Date time.Time `json:"date"` + } `json:"committer"` + } `json:"commit"` + } + if err := json.Unmarshal(body, &c); err != nil || c.Commit.Committer.Date.IsZero() { + return time.Time{}, fmt.Errorf("algolia tag %s: no commit date", tag) + } + return c.Commit.Committer.Date, nil +} + +// Fetch downloads the spec at tag and converts it from YAML to JSON, which is +// what diff.Parse reads (as for Datadog; the excerpts are re-serialized from +// the node either way). +// +// Version is the release's date from the tag (2026-11-17): Algolia's REST API +// has no version beyond the /1/ in its paths, and each API client has its own +// version numbers, so the day the spec was released is the closest thing to +// "the API version the change arrived in". +func (a Algolia) Fetch(ctx context.Context, tag string) (Spec, error) { + m := algoliaTag.FindStringSubmatch(tag) + if m == nil { + return Spec{}, fmt.Errorf("%q isn't an algolia release tag", tag) + } + url := fmt.Sprintf(algoliaSpecURLTemplate, tag, a.Spec) + body, err := fetch.Get(ctx, url, nil) // raw.githubusercontent.com needs no auth + if err != nil { + return Spec{}, fmt.Errorf("fetching algolia %s spec %s: %w", a.Spec, tag, err) + } + var doc any + if err := yaml.Unmarshal(body, &doc); err != nil { + return Spec{}, fmt.Errorf("parsing algolia %s spec %s as yaml: %w", a.Spec, tag, err) + } + content, err := json.Marshal(doc) + if err != nil { + return Spec{}, fmt.Errorf("converting algolia %s spec %s to json: %w", a.Spec, tag, err) + } + return Spec{Content: content, Version: m[1], SourceURL: url}, nil +} diff --git a/adapter/algolia_test.go b/adapter/algolia_test.go new file mode 100644 index 0000000..4c75673 --- /dev/null +++ b/adapter/algolia_test.go @@ -0,0 +1,108 @@ +package adapter + +import ( + "context" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func fakeAlgoliaGitHub(t *testing.T, refs string, commitDates, specs map[string]string) { + t.Helper() + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.URL.Path == "/refs": + w.Write([]byte(refs)) + case strings.HasPrefix(r.URL.Path, "/commits/"): + d, ok := commitDates[strings.TrimPrefix(r.URL.Path, "/commits/")] + if !ok { + http.NotFound(w, r) + return + } + w.Write([]byte(`{"commit":{"committer":{"date":"` + d + `"}}}`)) + default: + body, ok := specs[r.URL.Path] + if !ok { + http.NotFound(w, r) + return + } + w.Write([]byte(body)) + } + })) + t.Cleanup(srv.Close) + oldRefs, oldCommit, oldSpec := algoliaRefsURL, algoliaCommitURL, algoliaSpecURLTemplate + algoliaRefsURL = srv.URL + "/refs" + algoliaCommitURL = srv.URL + "/commits/%s" + algoliaSpecURLTemplate = srv.URL + "/%s/%s.yml" + t.Cleanup(func() { algoliaRefsURL, algoliaCommitURL, algoliaSpecURLTemplate = oldRefs, oldCommit, oldSpec }) +} + +func refs(tags ...string) string { + var parts []string + for _, t := range tags { + parts = append(parts, `{"ref":"refs/tags/`+t+`","object":{"type":"commit"}}`) + } + return "[" + strings.Join(parts, ",") + "]" +} + +func TestAlgoliaLatestTagIsTheNewestDay(t *testing.T) { + fakeAlgoliaGitHub(t, refs("released-2023-08-22", "released-2026-11-17-31c309fe2a", "released-2026-11-10-8d91e3d8a3", "v4.0.0"), nil, nil) + tag, err := Algolia{Spec: "search"}.LatestTag(context.Background()) + if err != nil || tag != "released-2026-11-17-31c309fe2a" { + t.Errorf("got %q, %v", tag, err) + } +} + +// Three releases on 2024-09-19: the suffix is a commit, so its order means +// nothing; the commit dates decide (a62c27d3b 10:17, 6e91dbf55 13:16, +// e47df6533 19:28, checked 2026-11-19). +func TestAlgoliaLatestTagBreaksASameDayTieByCommitDate(t *testing.T) { + fakeAlgoliaGitHub(t, refs("released-2024-09-19-6e91dbf55", "released-2024-09-19-e47df6533", "released-2024-09-19-a62c27d3b"), map[string]string{ + "released-2024-09-19-6e91dbf55": "2024-09-19T13:16:52Z", + "released-2024-09-19-a62c27d3b": "2024-09-19T10:17:21Z", + "released-2024-09-19-e47df6533": "2024-09-19T19:28:05Z", + }, nil) + tag, err := Algolia{Spec: "search"}.LatestTag(context.Background()) + if err != nil || tag != "released-2024-09-19-e47df6533" { + t.Errorf("got %q, %v; want the 19:28 release", tag, err) + } +} + +func TestAlgoliaLatestTagFailures(t *testing.T) { + fakeAlgoliaGitHub(t, refs("v4.0.0"), nil, nil) + if _, err := (Algolia{Spec: "search"}).LatestTag(context.Background()); err == nil { + t.Error("no release tag: want an error") + } + fakeAlgoliaGitHub(t, refs("released-2024-09-19-6e91dbf55", "released-2024-09-19-a62c27d3b"), nil, nil) + if _, err := (Algolia{Spec: "search"}).LatestTag(context.Background()); err == nil { + t.Error("a same-day tie without commit dates: want an error, not a guess") + } +} + +// The version is the release's date; the YAML is converted to JSON. +func TestAlgoliaFetch(t *testing.T) { + fakeAlgoliaGitHub(t, "", nil, map[string]string{ + "/released-2025-04-01-c19ee6afb/search.yml": "openapi: 3.0.2\ninfo:\n title: Search API\npaths:\n /1/clusters:\n get:\n deprecated: true\n", + }) + spec, err := Algolia{Spec: "search"}.Fetch(context.Background(), "released-2025-04-01-c19ee6afb") + if err != nil { + t.Fatal(err) + } + want := `{"info":{"title":"Search API"},"openapi":"3.0.2","paths":{"/1/clusters":{"get":{"deprecated":true}}}}` + if spec.Version != "2025-04-01" || string(spec.Content) != want || !strings.HasSuffix(spec.SourceURL, "/released-2025-04-01-c19ee6afb/search.yml") { + t.Errorf("got %q %s %s", spec.Version, spec.Content, spec.SourceURL) + } + if (Algolia{Spec: "search"}).API() != "algolia-search" { + t.Error("api slug") + } + for _, tag := range []string{"v4.0.0", "released-2025-04-01-c19ee6afb-x", "released-xx"} { + if _, err := (Algolia{Spec: "search"}).Fetch(context.Background(), tag); err == nil { + t.Errorf("%s: want an error", tag) + } + } + fakeAlgoliaGitHub(t, "", nil, map[string]string{"/released-2025-04-01/search.yml": "not: [valid: yaml"}) + if _, err := (Algolia{Spec: "search"}).Fetch(context.Background(), "released-2025-04-01"); err == nil { + t.Error("invalid yaml: want an error") + } +} diff --git a/docs/plugins.md b/docs/plugins.md index c245326..9800194 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,6 +15,9 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe | [`gitlab`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/gitlab.md) | GitLab | REST API changes between releases, request side only (what callers send) | `openapi` | [gitlab-org/gitlab `doc/api/openapi`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/api/openapi) | live | | [`vercel`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/vercel.md) | Vercel | REST API operations deprecated, and deprecated operations removed, between SDK releases of the spec | `openapi` | [vercel/sdk](https://github.com/vercel/sdk) (`vercel-spec.json`) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | | [`supabase`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/supabase.md) | Supabase | Management API operations deprecated, and deprecated operations removed, between commits of the spec | `openapi` | [supabase/supabase](https://github.com/supabase/supabase) (`apps/docs/spec/api_v1_openapi.json`) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | +| [`algolia-search`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | Search API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/search.yml`) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | +| [`algolia-ingestion`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | Ingestion API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/ingestion.yml`) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | +| [`algolia-recommend`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | Recommend API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/recommend.yml`) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | | [`mongodb-atlas`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/mongodb-atlas.md) | MongoDB | Atlas Administration API versions deprecated and removed at their sunset date, per endpoint, from MongoDB's own API changelog | `apichangelog` | [mongodb/openapi `changelog/changelog.json`](https://github.com/mongodb/openapi/blob/main/changelog/changelog.json) | paused: merged, not in a tagged release yet, so patch-it's hosted ingestion service doesn't run it | | [`openai-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/openai-models.md) | OpenAI | Model deprecations and shutdown dates (Chat Completions and Responses text models) | `retirements` | [OpenAI deprecations](https://developers.openai.com/api/docs/deprecations) | live | | [`anthropic-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/anthropic-models.md) | Anthropic | Model deprecations and retirement dates (Messages API models) | `retirements` | [Anthropic model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations) | live | diff --git a/plugins/openapi/algolia.go b/plugins/openapi/algolia.go new file mode 100644 index 0000000..2e1503f --- /dev/null +++ b/plugins/openapi/algolia.go @@ -0,0 +1,49 @@ +package openapi + +import "github.com/patch-it-dev/patch-it-plugins/diff" + +// algoliaDiff reads Algolia's specs like Supabase's: deprecations by the +// `deprecated` flag, quoting the whole operation, and path templates matched. +var algoliaDiff = diff.Options{PathTemplates: true, QuoteDeprecatedOperation: true} + +// algoliaKeep keeps operation deprecations, and removals of operations +// marked deprecated first, of REST operations only. Algolia's specs also +// describe what only its API clients do, and a change to one of those isn't +// an API change: +// +// - helpers, marked `x-helper: true`: /saveObjects, /waitForTask, +// /replaceAllObjects, … (16 in the Search API on 2026-11-17); +// - the "custom request" methods for any path, operationId customGet, +// customPost, customPut and customDelete on /{path} (before 2024-03-25, +// /1{path}). +// +// In every release from 2023-08-22 to 2026-11-17 this keeps 9 Search API +// deprecations (the multi-cluster /1/clusters endpoints, 2025-04-01) and 9 +// Ingestion API ones (the /1/tasks endpoints, 2025-01-22, and PUT +// /1/tasks/{taskID}/disable, 2024-07-26). None of the 17 removals in that +// history was deprecated first; 13 were the client-only entries above (the +// custom-request methods in all three specs on 2024-03-25, and /saveObjects). +func algoliaKeep(c diff.Change) bool { + // c.Node is the operation only because algoliaDiff sets + // QuoteDeprecatedOperation (a removal carries the old operation anyway); + // TestAlgoliaClientOnlyFilterThroughTheDiffer pins that. + op, _ := c.Node.(map[string]any) + if clientOnly(op) { + return false + } + return deprecationsOnly(algoliaDiff)(c) +} + +// clientOnly is an Algolia spec entry for an API-client method, not a REST +// operation. +func clientOnly(op map[string]any) bool { + if helper, _ := op["x-helper"].(bool); helper { + return true + } + id, _ := op["operationId"].(string) + switch id { + case "customGet", "customPost", "customPut", "customDelete": + return true + } + return false +} diff --git a/plugins/openapi/algolia_test.go b/plugins/openapi/algolia_test.go new file mode 100644 index 0000000..7635650 --- /dev/null +++ b/plugins/openapi/algolia_test.go @@ -0,0 +1,217 @@ +package openapi + +import ( + "context" + "encoding/json" + "fmt" + "os" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/adapter" + "github.com/patch-it-dev/patch-it-plugins/diff" + "github.com/patch-it-dev/patch-it-plugins/event" + "github.com/patch-it-dev/patch-it-plugins/kit/kittest" + "gopkg.in/yaml.v3" +) + +// fakeAlgoliaAdapter serves the trimmed copies of specs/bundled/.yml +// saved under testdata/ (every line unchanged; checked 2026-11-19), converted +// from YAML to JSON like adapter.Algolia.Fetch, and cited by the real URL. +type fakeAlgoliaAdapter struct{ spec string } + +func (f fakeAlgoliaAdapter) API() string { return "algolia-" + f.spec } + +func (fakeAlgoliaAdapter) LatestTag(context.Context) (string, error) { + return "", fmt.Errorf("replay only") +} + +func (f fakeAlgoliaAdapter) Fetch(_ context.Context, tag string) (adapter.Spec, error) { + body, err := os.ReadFile(algoliaFile(f.spec, tag)) + if err != nil { + return adapter.Spec{}, err + } + var doc any + if err := yaml.Unmarshal(body, &doc); err != nil { + return adapter.Spec{}, err + } + content, err := json.Marshal(doc) + if err != nil { + return adapter.Spec{}, err + } + return adapter.Spec{Content: content, Version: strings.TrimPrefix(tag, "released-")[:10], SourceURL: algoliaURL(f.spec, tag)}, nil +} + +func algoliaFile(spec, tag string) string { + return "testdata/algolia-" + spec + "-" + strings.TrimPrefix(tag, "released-") + ".yml" +} + +func algoliaURL(spec, tag string) string { + return "https://raw.githubusercontent.com/algolia/api-clients-automation/" + tag + "/specs/bundled/" + spec + ".yml" +} + +// algoliaPlugin is the plugin exactly as registered, over the saved copies. +func algoliaPlugin(spec string) Plugin { + return Plugin{Adapter: fakeAlgoliaAdapter{spec: spec}, Diff: algoliaDiff, Keep: algoliaKeep} +} + +// The golden tests, one per API with deprecations in its history, each a +// replay of the release that made them. +// +// - Search API, released-2025-04-01-c19ee6afb: the nine multi-cluster +// operations under /1/clusters. (The copies also keep /saveObjects, a +// client helper; it doesn't change here, so the filter for helpers is +// tested on its own below.) +// - Ingestion API, released-2025-01-22-232affcac: eight /1/tasks +// operations. PUT /1/tasks/{taskID}/disable was already deprecated +// (2024-07-26), so it's no new event. +func TestAlgoliaGolden(t *testing.T) { + for _, c := range []struct { + spec, from, to string + ops int + }{ + {"search", "released-2025-03-25-5c28957ec", "released-2025-04-01-c19ee6afb", 9}, + {"ingestion", "released-2025-01-07-d0417f325", "released-2025-01-22-232affcac", 8}, + } { + t.Run(c.spec, func(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, algoliaPlugin(c.spec), c.from, c.to); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + events := kittest.Stored(t, s) + if len(events) != c.ops { + for _, e := range events { + t.Logf("got: %s", e.Description) + } + t.Fatalf("%d events, want %d", len(events), c.ops) + } + for _, e := range events { + if e.ChangeType != event.ChangeTypeDeprecation || e.Version != c.to[9:19] || e.SourceURL != algoliaURL(c.spec, c.to) { + t.Errorf("%s: %s %s %s", e.Subject.Operation, e.ChangeType, e.Version, e.SourceURL) + } + if !strings.Contains(e.SourceExcerpt, `"deprecated":true`) { + t.Errorf("%s: excerpt lacks the flag: %.150s", e.Subject.Operation, e.SourceExcerpt) + } + if c.spec == "search" && !strings.HasPrefix(e.Subject.Operation, "GET /1/clusters") && !strings.HasPrefix(e.Subject.Operation, "POST /1/clusters") && !strings.HasPrefix(e.Subject.Operation, "DELETE /1/clusters") { + t.Errorf("unexpected search event %s", e.Subject.Operation) + } + if node := yamlNodeJSON(t, algoliaFile(c.spec, c.to), e.SourcePointer); node != e.SourceExcerpt && !truncated(e.SourceExcerpt, node) { + t.Errorf("%s: excerpt doesn't match %s#%s", e.Subject.Operation, c.to, e.SourcePointer) + } + } + kittest.Golden(t, "testdata/golden/algolia-"+c.spec+".json", events) + }) + } +} + +// The pinned drop test. The Ingestion API's GET and POST +// /1/transformations/models left the spec in released-2024-09-19-a62c27d3b +// without being deprecated first; nothing says Algolia stopped serving them. +// No event, though the same pair unfiltered reports both removals. +func TestAlgoliaDropsRemovalsThatWerentDeprecated(t *testing.T) { + ctx := context.Background() + const from, to = "released-2024-09-18-cc190fae3", "released-2024-09-19-a62c27d3b" + s := openStore(t) + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, algoliaPlugin("ingestion"), from, to); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + if events := kittest.Stored(t, s); len(events) != 0 { + t.Fatalf("%d events, want none", len(events)) + } + s = openStore(t) + p := algoliaPlugin("ingestion") + p.Keep = nil + if _, err := kittest.Replay(ctx, vercelEnv(s), s, p, from, to); err != nil { + t.Fatal(err) + } + var removed int + for _, e := range kittest.Stored(t, s) { + if strings.HasSuffix(e.Subject.Operation, " /1/transformations/models") && e.Breaking { + removed++ + } + } + if removed != 2 { + t.Errorf("unfiltered: %d /1/transformations/models removals, want 2", removed) + } +} + +// A client helper or a custom-request method is an API client's, not a REST +// operation: deprecated or removed, it makes no event. A REST operation does. +func TestAlgoliaClientOnlyEntriesMakeNoEvent(t *testing.T) { + for name, c := range map[string]struct { + op map[string]any + kind diff.Kind + want bool + }{ + "helper deprecated": {map[string]any{"x-helper": true, "operationId": "saveObjects", "deprecated": true}, diff.OperationDeprecated, false}, + "custom removed": {map[string]any{"operationId": "customPost", "deprecated": true}, diff.OperationRemoved, false}, + "rest deprecated": {map[string]any{"operationId": "listClusters", "deprecated": true}, diff.OperationDeprecated, true}, + "rest removed, marked": {map[string]any{"operationId": "listClusters", "deprecated": true}, diff.OperationRemoved, true}, + "rest removed, not": {map[string]any{"operationId": "listClusters"}, diff.OperationRemoved, false}, + } { + if got := algoliaKeep(diff.Change{Kind: c.kind, Node: c.op}); got != c.want { + t.Errorf("%s: kept=%v, want %v", name, got, c.want) + } + } +} + +// algolia-recommend's pinned drop test. Its history has no deprecation; the +// only removals were the custom-request methods, /1{path} becoming /{path} +// in released-2024-03-25-30207fcd0: client methods, not REST operations, and +// not deprecated first. No event, though unfiltered the pair reports the +// four removals. +func TestAlgoliaRecommendCustomRequestMoveIsNoEvent(t *testing.T) { + ctx := context.Background() + const from, to = "released-2024-03-19-2eac6f410", "released-2024-03-25-30207fcd0" + s := openStore(t) + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, algoliaPlugin("recommend"), from, to); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + if events := kittest.Stored(t, s); len(events) != 0 { + t.Fatalf("%d events, want none", len(events)) + } + s = openStore(t) + p := algoliaPlugin("recommend") + p.Keep = nil + if _, err := kittest.Replay(ctx, vercelEnv(s), s, p, from, to); err != nil { + t.Fatal(err) + } + var removed int + for _, e := range kittest.Stored(t, s) { + if strings.HasSuffix(e.Subject.Operation, " /1{path}") && e.Breaking { + removed++ + } + } + if removed != 4 { + t.Errorf("unfiltered: %d /1{path} removals, want 4", removed) + } +} + +// The client-only filter reads the operation a change is about, so it relies +// on algoliaDiff quoting the whole operation for a deprecation (without +// QuoteDeprecatedOperation the change carries the bare `true`). Through the +// real differ, a deprecated helper and a deprecated custom-request method +// make no event; a deprecated REST operation does. +func TestAlgoliaClientOnlyFilterThroughTheDiffer(t *testing.T) { + spec := func(deprecated bool) *diff.Spec { + d := fmt.Sprint(deprecated) + s, err := diff.Parse([]byte(`{"openapi":"3.0.2","info":{"version":"x"},"paths":{ + "/saveObjects":{"post":{"operationId":"saveObjects","x-helper":true,"deprecated":` + d + `,"responses":{}}}, + "/{path}":{"get":{"operationId":"customGet","deprecated":` + d + `,"responses":{}}}, + "/1/clusters":{"get":{"operationId":"listClusters","deprecated":` + d + `,"responses":{}}}}}`)) + if err != nil { + t.Fatal(err) + } + return s + } + var kept []string + for _, c := range diff.ChangesWith(spec(false), spec(true), algoliaDiff) { + if algoliaKeep(c) { + kept = append(kept, c.Operation) + } + } + if len(kept) != 1 || kept[0] != "GET /1/clusters" { + t.Errorf("kept %v, want only GET /1/clusters", kept) + } +} diff --git a/plugins/openapi/openapi.go b/plugins/openapi/openapi.go index 92d15a9..fa518af 100644 --- a/plugins/openapi/openapi.go +++ b/plugins/openapi/openapi.go @@ -1,8 +1,8 @@ // Package openapi is the source plugin for an API that publishes an OpenAPI -// spec per release (Stripe, Datadog, GitLab, GitHub, Vercel, Supabase): 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. It can also -// replay two given releases. +// spec per release (Stripe, Datadog, GitLab, GitHub, Vercel, Supabase, +// Algolia): 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. It can also replay two given releases. package openapi import ( @@ -36,6 +36,11 @@ func init() { // No Hints: Supabase's changelog is platform news, not keyed by // operation. Only operation deprecations and removals: see supabase.go. plugin.Register(Plugin{Adapter: adapter.Supabase{}, Diff: supabaseDiff, Keep: supabaseKeep}) + // No Hints: Algolia's changelog is a hosted product feed, not keyed by + // operation. One plugin per API spec: see algolia.go. + for _, spec := range []string{"search", "ingestion", "recommend"} { + plugin.Register(Plugin{Adapter: adapter.Algolia{Spec: spec}, Diff: algoliaDiff, Keep: algoliaKeep}) + } } // 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 355db8c..3232214 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{}} { + 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"}} { kittest.Registered(t, Plugin{Adapter: a}) } } diff --git a/plugins/openapi/testdata/README.md b/plugins/openapi/testdata/README.md index acc1d11..a93996e 100644 --- a/plugins/openapi/testdata/README.md +++ b/plugins/openapi/testdata/README.md @@ -15,6 +15,12 @@ Each pair is a real breaking change between two releases of a provider's own spe | `supabase-693bdc38.json`, `supabase-eb21ae25.json` | https://raw.githubusercontent.com/supabase/supabase/693bdc38d045353e5782f86febff4fddc82bb93a/apps/docs/spec/api_v1_openapi.json (and `eb21ae25f7954ea1e5db34209ff69fce597b0ae3`) | 2026-11-19 | Apache-2.0 (supabase/supabase) | `"deprecated": true` on `GET /v1/projects/{ref}/analytics/endpoints/logs.all` (new in `eb21ae25`) | | `supabase-8aef4a08.json`, `supabase-90b71e3e.json` | https://raw.githubusercontent.com/supabase/supabase/8aef4a08bf56e1e0e1eb8af316f7f0b2bcfd2e88/apps/docs/spec/api_v1_openapi.json (and `90b71e3e42c5f933013e1a62acdc37c07e9378d7`) | 2026-11-19 | Apache-2.0 (supabase/supabase) | `/v1/projects/{ref}/analytics/warehouse/...` (14 operations in `8aef4a08`, none deprecated, all gone in `90b71e3e`): the drop test | | `supabase-de806266.json`, `supabase-a5fc0527.json` | https://raw.githubusercontent.com/supabase/supabase/de806266717abddb08e285f9dd6d17ad7d262b34/apps/docs/spec/api_v1_openapi.json (and `a5fc0527045daaafd2a661146cac0b430adad20b`) | 2026-11-19 | Apache-2.0 (supabase/supabase) | `/v1/branches/{branch_id}` (in `de806266`), `/v1/branches/{branch_id_or_ref}` (in `a5fc0527`) | +| `algolia-search-2025-03-25-5c28957ec.yml`, `algolia-search-2025-04-01-c19ee6afb.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-03-25-5c28957ec/specs/bundled/search.yml (and `released-2025-04-01-c19ee6afb`) | 2026-11-19 | MIT (algolia/api-clients-automation) | `deprecated: true` under `/1/clusters:` `get:` (new in `2025-04-01`) | +| `algolia-ingestion-2025-01-07-d0417f325.yml`, `algolia-ingestion-2025-01-22-232affcac.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-07-d0417f325/specs/bundled/ingestion.yml (and `released-2025-01-22-232affcac`) | 2026-11-19 | MIT (algolia/api-clients-automation) | "Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead." (`GET /1/tasks`) | +| `algolia-recommend-2024-03-19-2eac6f410.yml`, `algolia-recommend-2024-03-25-30207fcd0.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2024-03-19-2eac6f410/specs/bundled/recommend.yml (and `released-2024-03-25-30207fcd0`) | 2026-11-19 | MIT (algolia/api-clients-automation) | `/1{path}:` (in `2024-03-19`), `/{path}:` (in `2024-03-25`): `algolia-recommend`'s drop test | +| `algolia-ingestion-2024-09-18-cc190fae3.yml`, `algolia-ingestion-2024-09-19-a62c27d3b.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2024-09-18-cc190fae3/specs/bundled/ingestion.yml (and `released-2024-09-19-a62c27d3b`) | 2026-11-19 | MIT (algolia/api-clients-automation) | `/1/transformations/models:` (in `2024-09-18`, never deprecated, gone in `2024-09-19`): the drop test | + +The Algolia copies are trimmed by lines: `openapi`, `info` and the paths involved, every line copied unchanged; `components` left out. The Supabase copies keep each value unchanged but are re-indented: the source is Prettier-formatted (objects on one line where they fit), and minified on one line before 2025. diff --git a/plugins/openapi/testdata/algolia-ingestion-2024-09-18-cc190fae3.yml b/plugins/openapi/testdata/algolia-ingestion-2024-09-18-cc190fae3.yml new file mode 100644 index 0000000..c493fe3 --- /dev/null +++ b/plugins/openapi/testdata/algolia-ingestion-2024-09-18-cc190fae3.yml @@ -0,0 +1,363 @@ +openapi: 3.0.2 +info: + title: Ingestion API + description: > + The Ingestion API lets you connect third-party services and platforms with + Algolia and schedule tasks to ingest your data. + + The Ingestion API powers the no-code [data + connectors](https://dashboard.algolia.com/connectors). + + + ## Base URLs + + + The base URLs for requests to the Ingestion API are: + + + - `https://data.us.algolia.com` + + - `https://data.eu.algolia.com` + + + Use the URL that matches your [analytics + region](https://dashboard.algolia.com/account/infrastructure/analytics). + + + **All requests must use HTTPS.** + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Request bodies must be JSON objects. + + + ## Response status and errors + + + Response bodies are JSON objects. + + Deleting a user token returns an empty response body with rate-limiting + information as headers. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + The Insights API doesn't validate if the event parameters such as + `indexName`, `objectIDs`, or `userToken`, + + correspond to anything in the Search API. It justs checks if they're + formatted correctly. + + Check the [Events](https://dashboard.algolia.com/events/health) health + section, + + whether your events can be used for Algolia features such as Analytics, or + Dynamic Re-Ranking. + + + ## Version + + + The current version of the Insights API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/transformations: + get: + tags: + - ingestion + summary: List transformations + description: Retrieves a list of transformations. + operationId: listTransformations + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/parameters_sort' + - $ref: '#/components/parameters/order' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listTransformationsResponse + type: object + description: Configured transformations and pagination information. + additionalProperties: false + properties: + transformations: + type: array + items: + $ref: '#/components/schemas/Transformation' + pagination: + $ref: '#/components/schemas/Pagination' + required: + - transformations + - pagination + '400': + $ref: '#/components/responses/BadRequest' + post: + tags: + - ingestion + summary: Create a transformation + description: Creates a new transformation. + operationId: createTransformation + requestBody: + description: Request body for creating a transformation. + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreate' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/try: + post: + tags: + - ingestion + summary: Try a transformation + description: Try a transformation before creating it. + operationId: tryTransformation + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTry' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTryResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/search: + post: + tags: + - ingestion + summary: Search for transformations + description: Searches for transformations. + operationId: searchTransformations + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationSearch' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchTransformationsResponse + type: array + items: + $ref: '#/components/schemas/Transformation' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/models: + get: + tags: + - ingestion + summary: Retrieve existing LLM transformation helpers + description: Retrieves a list of existing LLM transformation helpers. + operationId: listTransformationModels + x-acl: + - addObject + - deleteIndex + - editSettings + responses: + '200': + description: OK + content: + application/json: + schema: + title: transformationModels + type: object + description: List of available AI models for transformation purposes. + additionalProperties: false + properties: + llms: + type: array + items: + $ref: '#/components/schemas/Model' + required: + - llms + '400': + $ref: '#/components/responses/BadRequest' + post: + tags: + - ingestion + summary: Generates code for the selected model based on the given prompt + description: Generates code for the selected model based on the given prompt. + operationId: generateTransformationCode + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + title: generateTransformationCodePayload + type: object + additionalProperties: false + properties: + id: + type: string + systemPrompt: + type: string + userPrompt: + type: string + required: + - id + - userPrompt + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: generateTransformationCodeResponse + type: object + additionalProperties: false + properties: + generatedCode: + type: string + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/{transformationID}: + get: + tags: + - ingestion + summary: Retrieve a transformation + description: Retrieves a transformation by its ID. + operationId: getTransformation + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTransformationID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Transformation' + '400': + $ref: '#/components/responses/BadRequest' + put: + tags: + - ingestion + summary: Update a transformation + description: Updates a transformation by its ID. + operationId: updateTransformation + parameters: + - $ref: '#/components/parameters/pathTransformationID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreate' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - ingestion + summary: Delete a transformation + description: Deletes a transformation by its ID. + operationId: deleteTransformation + parameters: + - $ref: '#/components/parameters/pathTransformationID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/{transformationID}/try: + post: + tags: + - ingestion + summary: Try a transformation + description: Try a transformation before updating it. + operationId: tryTransformationBeforeUpdate + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTransformationID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTry' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTryResponse' + '400': + $ref: '#/components/responses/BadRequest' diff --git a/plugins/openapi/testdata/algolia-ingestion-2024-09-19-a62c27d3b.yml b/plugins/openapi/testdata/algolia-ingestion-2024-09-19-a62c27d3b.yml new file mode 100644 index 0000000..e6b5321 --- /dev/null +++ b/plugins/openapi/testdata/algolia-ingestion-2024-09-19-a62c27d3b.yml @@ -0,0 +1,291 @@ +openapi: 3.0.2 +info: + title: Ingestion API + description: > + The Ingestion API lets you connect third-party services and platforms with + Algolia and schedule tasks to ingest your data. + + The Ingestion API powers the no-code [data + connectors](https://dashboard.algolia.com/connectors). + + + ## Base URLs + + + The base URLs for requests to the Ingestion API are: + + + - `https://data.us.algolia.com` + + - `https://data.eu.algolia.com` + + + Use the URL that matches your [analytics + region](https://dashboard.algolia.com/account/infrastructure/analytics). + + + **All requests must use HTTPS.** + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Request bodies must be JSON objects. + + + ## Response status and errors + + + Response bodies are JSON objects. + + Deleting a user token returns an empty response body with rate-limiting + information as headers. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + The Insights API doesn't validate if the event parameters such as + `indexName`, `objectIDs`, or `userToken`, + + correspond to anything in the Search API. It justs checks if they're + formatted correctly. + + Check the [Events](https://dashboard.algolia.com/events/health) health + section, + + whether your events can be used for Algolia features such as Analytics, or + Dynamic Re-Ranking. + + + ## Version + + + The current version of the Insights API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/transformations: + get: + tags: + - ingestion + summary: List transformations + description: Retrieves a list of transformations. + operationId: listTransformations + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/parameters_sort' + - $ref: '#/components/parameters/order' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listTransformationsResponse + type: object + description: Configured transformations and pagination information. + additionalProperties: false + properties: + transformations: + type: array + items: + $ref: '#/components/schemas/Transformation' + pagination: + $ref: '#/components/schemas/Pagination' + required: + - transformations + - pagination + '400': + $ref: '#/components/responses/BadRequest' + post: + tags: + - ingestion + summary: Create a transformation + description: Creates a new transformation. + operationId: createTransformation + requestBody: + description: Request body for creating a transformation. + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreate' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/try: + post: + tags: + - ingestion + summary: Try a transformation + description: Try a transformation before creating it. + operationId: tryTransformation + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTry' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTryResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/search: + post: + tags: + - ingestion + summary: Search for transformations + description: Searches for transformations. + operationId: searchTransformations + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationSearch' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchTransformationsResponse + type: array + items: + $ref: '#/components/schemas/Transformation' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/{transformationID}: + get: + tags: + - ingestion + summary: Retrieve a transformation + description: Retrieves a transformation by its ID. + operationId: getTransformation + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTransformationID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Transformation' + '400': + $ref: '#/components/responses/BadRequest' + put: + tags: + - ingestion + summary: Update a transformation + description: Updates a transformation by its ID. + operationId: updateTransformation + parameters: + - $ref: '#/components/parameters/pathTransformationID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationCreate' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - ingestion + summary: Delete a transformation + description: Deletes a transformation by its ID. + operationId: deleteTransformation + parameters: + - $ref: '#/components/parameters/pathTransformationID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/transformations/{transformationID}/try: + post: + tags: + - ingestion + summary: Try a transformation + description: Try a transformation before updating it. + operationId: tryTransformationBeforeUpdate + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTransformationID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTry' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransformationTryResponse' + '400': + $ref: '#/components/responses/BadRequest' diff --git a/plugins/openapi/testdata/algolia-ingestion-2025-01-07-d0417f325.yml b/plugins/openapi/testdata/algolia-ingestion-2025-01-07-d0417f325.yml new file mode 100644 index 0000000..ab3485e --- /dev/null +++ b/plugins/openapi/testdata/algolia-ingestion-2025-01-07-d0417f325.yml @@ -0,0 +1,309 @@ +openapi: 3.0.2 +info: + title: Ingestion API + description: > + The Ingestion API lets you connect third-party services and platforms with + Algolia and schedule tasks to ingest your data. + + The Ingestion API powers the no-code [data + connectors](https://dashboard.algolia.com/connectors). + + + ## Base URLs + + + The base URLs for requests to the Ingestion API are: + + + - `https://data.us.algolia.com` + + - `https://data.eu.algolia.com` + + + Use the URL that matches your [analytics + region](https://dashboard.algolia.com/account/infrastructure/analytics). + + + **All requests must use HTTPS.** + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Request bodies must be JSON objects. + + + ## Response status and errors + + + Response bodies are JSON objects. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + ## Version + + + The current version of the Ingestion API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/tasks: + get: + tags: + - ingestion + summary: List tasks + description: >- + Retrieves a list of tasks using the v1 endpoint, please use `getTasks` + instead. + operationId: listTasksV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/action' + - $ref: '#/components/parameters/enabled' + - $ref: '#/components/parameters/sourceID' + - $ref: '#/components/parameters/destinationID' + - $ref: '#/components/parameters/triggerType' + - $ref: '#/components/parameters/taskParameters_sort' + - $ref: '#/components/parameters/order' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listTasksResponseV1 + type: object + description: Configured tasks and pagination information. + additionalProperties: false + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/TaskV1' + pagination: + $ref: '#/components/schemas/Pagination' + required: + - tasks + - pagination + '400': + $ref: '#/components/responses/BadRequest' + post: + tags: + - ingestion + summary: Create a task + description: >- + Creates a new task using the v1 endpoint, please use `createTask` + instead. + operationId: createTaskV1 + x-codegen-request-body-name: taskCreate + requestBody: + description: Request body for creating a task. + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCreateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCreateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/search: + post: + tags: + - ingestion + summary: Search for tasks + description: >- + Searches for tasks using the v1 endpoint, please use `searchTasks` + instead. + operationId: searchTasksV1 + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskSearch' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchTasksResponseV1 + type: array + items: + $ref: '#/components/schemas/TaskV1' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}: + get: + tags: + - ingestion + summary: Retrieve a task + description: >- + Retrieves a task by its ID using the v1 endpoint, please use `getTask` + instead. + operationId: getTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskV1' + '400': + $ref: '#/components/responses/BadRequest' + patch: + tags: + - ingestion + summary: Update a task + description: >- + Updates a task by its ID using the v1 endpoint, please use `updateTask` + instead. + operationId: updateTaskV1 + parameters: + - $ref: '#/components/parameters/pathTaskID' + x-codegen-request-body-name: taskUpdate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - ingestion + summary: Delete a task + description: >- + Deletes a task by its ID using the v1 endpoint, please use `deleteTask` + instead. + operationId: deleteTaskV1 + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/run: + post: + tags: + - ingestion + summary: Run a task + description: >- + Runs a task using the v1 endpoint, please use `runTask` instead. You can + check the status of task runs with the observability endpoints. + operationId: runTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/enable: + put: + tags: + - ingestion + summary: Enable a task + description: Enables a task using the v1 endpoint, please use `enableTask` instead. + operationId: enableTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/disable: + put: + tags: + - ingestion + summary: Disable a task + description: Disables a task using the v1 endpoint, please use `disableTask` instead. + operationId: disableTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' diff --git a/plugins/openapi/testdata/algolia-ingestion-2025-01-22-232affcac.yml b/plugins/openapi/testdata/algolia-ingestion-2025-01-22-232affcac.yml new file mode 100644 index 0000000..05ab3a6 --- /dev/null +++ b/plugins/openapi/testdata/algolia-ingestion-2025-01-22-232affcac.yml @@ -0,0 +1,317 @@ +openapi: 3.0.2 +info: + title: Ingestion API + description: > + The Ingestion API lets you connect third-party services and platforms with + Algolia and schedule tasks to ingest your data. + + The Ingestion API powers the no-code [data + connectors](https://dashboard.algolia.com/connectors). + + + ## Base URLs + + + The base URLs for requests to the Ingestion API are: + + + - `https://data.us.algolia.com` + + - `https://data.eu.algolia.com` + + + Use the URL that matches your [analytics + region](https://dashboard.algolia.com/account/infrastructure/analytics). + + + **All requests must use HTTPS.** + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Request bodies must be JSON objects. + + + ## Response status and errors + + + Response bodies are JSON objects. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + ## Version + + + The current version of the Ingestion API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/tasks: + get: + tags: + - ingestion + summary: List tasks V1 + description: >- + Retrieves a list of tasks using the v1 endpoint, please use `getTasks` + instead. + operationId: listTasksV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/action' + - $ref: '#/components/parameters/enabled' + - $ref: '#/components/parameters/sourceID' + - $ref: '#/components/parameters/destinationID' + - $ref: '#/components/parameters/triggerType' + - $ref: '#/components/parameters/taskParameters_sort' + - $ref: '#/components/parameters/order' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listTasksResponseV1 + type: object + description: Configured tasks and pagination information. + additionalProperties: false + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/TaskV1' + pagination: + $ref: '#/components/schemas/Pagination' + required: + - tasks + - pagination + '400': + $ref: '#/components/responses/BadRequest' + post: + tags: + - ingestion + summary: Create a task V1 + description: >- + Creates a new task using the v1 endpoint, please use `createTask` + instead. + operationId: createTaskV1 + deprecated: true + x-codegen-request-body-name: taskCreate + requestBody: + description: Request body for creating a task. + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCreateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCreateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/search: + post: + tags: + - ingestion + summary: Search for tasks V1 + description: >- + Searches for tasks using the v1 endpoint, please use `searchTasks` + instead. + operationId: searchTasksV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskSearch' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchTasksResponseV1 + type: array + items: + $ref: '#/components/schemas/TaskV1' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}: + get: + tags: + - ingestion + summary: Retrieve a task V1 + description: >- + Retrieves a task by its ID using the v1 endpoint, please use `getTask` + instead. + operationId: getTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskV1' + '400': + $ref: '#/components/responses/BadRequest' + patch: + tags: + - ingestion + summary: Update a task V1 + description: >- + Updates a task by its ID using the v1 endpoint, please use `updateTask` + instead. + operationId: updateTaskV1 + deprecated: true + parameters: + - $ref: '#/components/parameters/pathTaskID' + x-codegen-request-body-name: taskUpdate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - ingestion + summary: Delete a task + description: >- + Deletes a task by its ID using the v1 endpoint, please use `deleteTask` + instead. + operationId: deleteTaskV1 + deprecated: true + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/run: + post: + tags: + - ingestion + summary: Run a task V1 + description: >- + Runs a task using the v1 endpoint, please use `runTask` instead. You can + check the status of task runs with the observability endpoints. + operationId: runTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RunResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/enable: + put: + tags: + - ingestion + summary: Enable a task V1 + description: Enables a task using the v1 endpoint, please use `enableTask` instead. + operationId: enableTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' + /1/tasks/{taskID}/disable: + put: + tags: + - ingestion + summary: Disable a task V1 + description: Disables a task using the v1 endpoint, please use `disableTask` instead. + operationId: disableTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '#/components/parameters/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateResponse' + '400': + $ref: '#/components/responses/BadRequest' diff --git a/plugins/openapi/testdata/algolia-recommend-2024-03-19-2eac6f410.yml b/plugins/openapi/testdata/algolia-recommend-2024-03-19-2eac6f410.yml new file mode 100644 index 0000000..769be4c --- /dev/null +++ b/plugins/openapi/testdata/algolia-recommend-2024-03-19-2eac6f410.yml @@ -0,0 +1,122 @@ +openapi: 3.0.2 +info: + title: Recommend API + description: >- + The Recommend API lets you generate recommendations with several AI models. + + + > **Note**: You should use Algolia's [libraries and + tools](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) + to interact with the Recommend API. Using the HTTP endpoints directly is not + covered by the [SLA](https://www.algolia.com/policies/sla/). + version: 1.0.0 +paths: + /1{path}: + get: + operationId: customGet + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + post: + operationId: customPost + requestBody: + description: Parameters to send with the custom request. + content: + application/json: + schema: + type: object + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + put: + operationId: customPut + requestBody: + description: Parameters to send with the custom request. + content: + application/json: + schema: + type: object + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + delete: + operationId: customDelete + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend diff --git a/plugins/openapi/testdata/algolia-recommend-2024-03-25-30207fcd0.yml b/plugins/openapi/testdata/algolia-recommend-2024-03-25-30207fcd0.yml new file mode 100644 index 0000000..d7fb7f4 --- /dev/null +++ b/plugins/openapi/testdata/algolia-recommend-2024-03-25-30207fcd0.yml @@ -0,0 +1,122 @@ +openapi: 3.0.2 +info: + title: Recommend API + description: >- + The Recommend API lets you generate recommendations with several AI models. + + + > **Note**: You should use Algolia's [libraries and + tools](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) + to interact with the Recommend API. Using the HTTP endpoints directly is not + covered by the [SLA](https://www.algolia.com/policies/sla/). + version: 1.0.0 +paths: + /{path}: + get: + operationId: customGet + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + post: + operationId: customPost + requestBody: + description: Parameters to send with the custom request. + content: + application/json: + schema: + type: object + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + put: + operationId: customPut + requestBody: + description: Parameters to send with the custom request. + content: + application/json: + schema: + type: object + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend + delete: + operationId: customDelete + summary: Send requests to the Algolia REST API. + description: This method allow you to send requests to the Algolia REST API. + parameters: + - $ref: '#/components/parameters/PathInPath' + - $ref: '#/components/parameters/Parameters' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + tags: + - recommend diff --git a/plugins/openapi/testdata/algolia-search-2025-03-25-5c28957ec.yml b/plugins/openapi/testdata/algolia-search-2025-03-25-5c28957ec.yml new file mode 100644 index 0000000..23267ac --- /dev/null +++ b/plugins/openapi/testdata/algolia-search-2025-03-25-5c28957ec.yml @@ -0,0 +1,648 @@ +openapi: 3.0.2 +info: + title: Search API + description: > + The Algolia Search API lets you search, configure, and manage your indices + and records. + + + ## Client libraries + + + Use Algolia's API clients and libraries to reliably integrate Algolia's APIs + with your apps. + + The official API clients are covered by Algolia's [Service Level + Agreement](https://www.algolia.com/policies/sla/). + + + See: [Algolia's + ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) + + + ## Base URLs + + + The base URLs for requests to the Search API are: + + + - `https://{APPLICATION_ID}.algolia.net` + + - `https://{APPLICATION_ID}-dsn.algolia.net`. + If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra), + this ensures that requests are sent to servers closest to users. + + Both URLs provide high availability by distributing requests with load + balancing. + + + **All requests must use HTTPS.** + + + ## Retry strategy + + + To guarantee high availability, implement a retry strategy for all API + requests using the URLs of your servers as fallbacks: + + + - `https://{APPLICATION_ID}-1.algolianet.com` + + - `https://{APPLICATION_ID}-2.algolianet.com` + + - `https://{APPLICATION_ID}-3.algolianet.com` + + + These URLs use a different DNS provider than the primary URLs. + + You should randomize this list to ensure an even load across the three + servers. + + + All Algolia API clients implement this retry strategy. + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Depending on the endpoint, request bodies are either JSON objects or arrays + of JSON objects, + + + ## Parameters + + + Parameters are passed as query parameters for GET and DELETE requests, + + and in the request body for POST and PUT requests. + + + Query parameters must be + [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). + + Non-ASCII characters must be UTF-8 encoded. + + Plus characters (`+`) are interpreted as spaces. + + Arrays as query parameters must be one of: + + + - A comma-separated string: `attributesToRetrieve=title,description` + + - A URL-encoded JSON array: + `attributesToRetrieve=%5B%22title%22,%22description%22%D` + + + ## Response status and errors + + + The Search API returns JSON responses. + + Since JSON doesn't guarantee any specific ordering, don't rely on the order + of attributes in the API response. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + ## Version + + + The current version of the Search API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/clusters/mapping: + post: + tags: + - search + operationId: assignUserId + x-acl: + - admin + summary: Assign or move a user ID + description: > + Assigns or moves a user ID to a cluster. + + + The time it takes to move a user is proportional to the amount of data + linked to the user ID. + parameters: + - $ref: '#/components/parameters/UserIDInHeader' + requestBody: + required: true + content: + application/json: + schema: + title: assignUserIdParams + type: object + description: Assign userID parameters. + additionalProperties: false + properties: + cluster: + $ref: '#/components/schemas/clusterName' + required: + - cluster + responses: + '200': + $ref: '#/components/responses/CreatedAt' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + get: + tags: + - search + operationId: listUserIds + x-acl: + - admin + summary: List user IDs + description: > + Lists the userIDs assigned to a multi-cluster application. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/HitsPerPage' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listUserIdsResponse + type: object + description: User ID data. + properties: + userIDs: + type: array + description: User IDs. + items: + $ref: '#/components/schemas/userId' + required: + - userIDs + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/batch: + post: + tags: + - search + operationId: batchAssignUserIds + x-acl: + - admin + summary: Assign multiple userIDs + description: | + Assigns multiple user IDs to a cluster. + + **You can't move users with this operation**. + parameters: + - $ref: '#/components/parameters/UserIDInHeader' + requestBody: + required: true + content: + application/json: + schema: + title: batchAssignUserIdsParams + type: object + description: Assign userID parameters. + additionalProperties: false + properties: + cluster: + $ref: '#/components/schemas/clusterName' + users: + type: array + description: User IDs to assign. + example: + - einstein + - bohr + - feynman + items: + type: string + required: + - cluster + - users + responses: + '200': + $ref: '#/components/responses/CreatedAt' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/top: + get: + tags: + - search + operationId: getTopUserIds + x-acl: + - admin + summary: Get top user IDs + description: > + Get the IDs of the 10 users with the highest number of records per + cluster. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + responses: + '200': + description: OK + content: + application/json: + schema: + title: getTopUserIdsResponse + type: object + description: User IDs and clusters. + properties: + topUsers: + type: array + description: >- + Key-value pairs with cluster names as keys and lists of + users with the highest number of records per cluster as + values. + items: + type: object + additionalProperties: + x-additionalPropertiesName: cluster + type: array + items: + $ref: '#/components/schemas/userId' + required: + - topUsers + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/{userID}: + get: + tags: + - search + operationId: getUserId + x-acl: + - admin + summary: Retrieve user ID + description: > + Returns the user ID data stored in the mapping. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + parameters: + - $ref: '#/components/parameters/UserIDInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/userId' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + delete: + tags: + - search + operationId: removeUserId + x-acl: + - admin + summary: Delete user ID + description: Deletes a user ID and its associated data from the clusters. + parameters: + - $ref: '#/components/parameters/UserIDInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + title: removeUserIdResponse + type: object + additionalProperties: false + properties: + deletedAt: + $ref: '#/components/schemas/deletedAt' + required: + - deletedAt + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters: + get: + tags: + - search + operationId: listClusters + x-acl: + - admin + summary: List clusters + description: Lists the available clusters in a multi-cluster setup. + responses: + '200': + description: OK + content: + application/json: + schema: + title: listClustersResponse + type: object + description: Clusters. + properties: + topUsers: + type: array + description: >- + Key-value pairs with cluster names as keys and lists of + users with the highest number of records per cluster as + values. + items: + $ref: '#/components/schemas/clusterName' + required: + - topUsers + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/search: + post: + tags: + - search + operationId: searchUserIds + x-use-read-transporter: true + x-cacheable: true + x-acl: + - admin + summary: Search for user IDs + description: > + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + + + To ensure rapid updates, the user IDs index isn't built at the same time + as the mapping. Instead, it's built every 12 hours, at the same time as + the update of user ID usage. For example, if you add or move a user ID, + the search will show an old value until the next time the mapping is + rebuilt (every 12 hours). + requestBody: + required: true + content: + application/json: + schema: + title: searchUserIdsParams + type: object + description: OK + additionalProperties: false + properties: + query: + type: string + description: >- + Query to search. The search is a prefix search with [typo + tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) + enabled. An empty query will retrieve all users. + clusterName: + $ref: '#/components/schemas/clusterName' + page: + $ref: '#/components/schemas/page' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - query + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchUserIdsResponse + type: object + description: userIDs data. + properties: + hits: + type: array + description: User objects that match the query. + items: + title: userHit + type: object + properties: + userID: + $ref: '#/components/schemas/userID' + clusterName: + $ref: '#/components/schemas/clusterName' + nbRecords: + $ref: '#/components/schemas/nbRecords' + dataSize: + $ref: '#/components/schemas/dataSize' + objectID: + type: string + description: userID of the requested user. Same as userID. + _highlightResult: + title: userHighlightResult + type: object + properties: + userID: + $ref: '#/components/schemas/highlightResult' + clusterName: + $ref: '#/components/schemas/highlightResult' + required: + - userID + - clusterName + required: + - userID + - clusterName + - nbRecords + - dataSize + - objectID + - _highlightResult + nbHits: + $ref: '#/components/schemas/nbHits' + page: + $ref: '#/components/schemas/page' + hitsPerPage: + $ref: '#/components/schemas/parameters_hitsPerPage' + updatedAt: + $ref: '#/components/schemas/updatedAt' + required: + - hits + - nbHits + - page + - hitsPerPage + - updatedAt + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/pending: + get: + tags: + - search + operationId: hasPendingMappings + x-acl: + - admin + summary: Get migration and user mapping status + description: > + To determine when the time-consuming process of creating a large batch + of users or migrating users from one cluster to another is complete, + this operation retrieves the status of the process. + parameters: + - in: query + name: getClusters + description: >- + Whether to include the cluster's pending mapping state in the + response. + schema: + type: boolean + responses: + '200': + description: OK + content: + application/json: + schema: + title: hasPendingMappingsResponse + type: object + additionalProperties: false + properties: + pending: + description: >- + Whether there are clusters undergoing migration, creation, + or deletion. + type: boolean + clusters: + description: > + Cluster pending mapping state: migrating, creating, + deleting. + type: object + additionalProperties: + type: array + items: + type: string + required: + - pending + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /saveObjects: + get: + x-helper: true + tags: + - search + operationId: saveObjects + summary: Saves the given array of objects in the given index + description: > + Helper: Saves the given array of objects in the given index. The + `chunkedBatch` helper is used under the hood, which creates a `batch` + requests with at most 1000 objects in it. + parameters: + - in: query + name: indexName + description: The `indexName` to save `objects` into. + required: true + schema: + type: string + - in: query + name: objects + description: The objects to save in the index. + required: true + schema: + type: array + items: + type: object + - in: query + name: waitForTasks + description: >- + Whether or not we should wait until every `batch` tasks has been + processed, this operation may slow the total execution time of this + method but is more reliable. + required: false + schema: + type: boolean + default: false + - in: query + name: batchSize + description: >- + The size of the chunk of `objects`. The number of `batch` calls will + be equal to `length(objects) / batchSize`. Defaults to 1000. + required: false + schema: + type: integer + default: 1000 + - in: query + name: requestOptions + description: The request options to pass to the `batch` method. + required: false + schema: + type: object + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/batchResponse' + '400': + $ref: '#/components/responses/IndexNotFound' diff --git a/plugins/openapi/testdata/algolia-search-2025-04-01-c19ee6afb.yml b/plugins/openapi/testdata/algolia-search-2025-04-01-c19ee6afb.yml new file mode 100644 index 0000000..6679026 --- /dev/null +++ b/plugins/openapi/testdata/algolia-search-2025-04-01-c19ee6afb.yml @@ -0,0 +1,657 @@ +openapi: 3.0.2 +info: + title: Search API + description: > + The Algolia Search API lets you search, configure, and manage your indices + and records. + + + ## Client libraries + + + Use Algolia's API clients and libraries to reliably integrate Algolia's APIs + with your apps. + + The official API clients are covered by Algolia's [Service Level + Agreement](https://www.algolia.com/policies/sla/). + + + See: [Algolia's + ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) + + + ## Base URLs + + + The base URLs for requests to the Search API are: + + + - `https://{APPLICATION_ID}.algolia.net` + + - `https://{APPLICATION_ID}-dsn.algolia.net`. + If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra), + this ensures that requests are sent to servers closest to users. + + Both URLs provide high availability by distributing requests with load + balancing. + + + **All requests must use HTTPS.** + + + ## Retry strategy + + + To guarantee high availability, implement a retry strategy for all API + requests using the URLs of your servers as fallbacks: + + + - `https://{APPLICATION_ID}-1.algolianet.com` + + - `https://{APPLICATION_ID}-2.algolianet.com` + + - `https://{APPLICATION_ID}-3.algolianet.com` + + + These URLs use a different DNS provider than the primary URLs. + + You should randomize this list to ensure an even load across the three + servers. + + + All Algolia API clients implement this retry strategy. + + + ## Authentication + + + To authenticate your API requests, add these headers: + + + - `x-algolia-application-id`. Your Algolia application ID. + + - `x-algolia-api-key`. An API key with the necessary permissions to make the + request. + The required access control list (ACL) to make a request is listed in each endpoint's reference. + + You can find your application ID and API key in the [Algolia + dashboard](https://dashboard.algolia.com/account). + + + ## Request format + + + Depending on the endpoint, request bodies are either JSON objects or arrays + of JSON objects, + + + ## Parameters + + + Parameters are passed as query parameters for GET and DELETE requests, + + and in the request body for POST and PUT requests. + + + Query parameters must be + [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). + + Non-ASCII characters must be UTF-8 encoded. + + Plus characters (`+`) are interpreted as spaces. + + Arrays as query parameters must be one of: + + + - A comma-separated string: `attributesToRetrieve=title,description` + + - A URL-encoded JSON array: + `attributesToRetrieve=%5B%22title%22,%22description%22%D` + + + ## Response status and errors + + + The Search API returns JSON responses. + + Since JSON doesn't guarantee any specific ordering, don't rely on the order + of attributes in the API response. + + + Successful responses return a `2xx` status. Client errors return a `4xx` + status. Server errors are indicated by a `5xx` status. + + Error responses have a `message` property with more information. + + + ## Version + + + The current version of the Search API is version 1, as indicated by the + `/1/` in each endpoint's URL. + version: 1.0.0 +paths: + /1/clusters/mapping: + post: + tags: + - search + operationId: assignUserId + deprecated: true + x-acl: + - admin + summary: Assign or move a user ID + description: > + Assigns or moves a user ID to a cluster. + + + The time it takes to move a user is proportional to the amount of data + linked to the user ID. + parameters: + - $ref: '#/components/parameters/UserIDInHeader' + requestBody: + required: true + content: + application/json: + schema: + title: assignUserIdParams + type: object + description: Assign userID parameters. + additionalProperties: false + properties: + cluster: + $ref: '#/components/schemas/clusterName' + required: + - cluster + responses: + '200': + $ref: '#/components/responses/CreatedAt' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + get: + tags: + - search + operationId: listUserIds + deprecated: true + x-acl: + - admin + summary: List user IDs + description: > + Lists the userIDs assigned to a multi-cluster application. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/HitsPerPage' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listUserIdsResponse + type: object + description: User ID data. + properties: + userIDs: + type: array + description: User IDs. + items: + $ref: '#/components/schemas/userId' + required: + - userIDs + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/batch: + post: + tags: + - search + operationId: batchAssignUserIds + deprecated: true + x-acl: + - admin + summary: Assign multiple userIDs + description: | + Assigns multiple user IDs to a cluster. + + **You can't move users with this operation**. + parameters: + - $ref: '#/components/parameters/UserIDInHeader' + requestBody: + required: true + content: + application/json: + schema: + title: batchAssignUserIdsParams + type: object + description: Assign userID parameters. + additionalProperties: false + properties: + cluster: + $ref: '#/components/schemas/clusterName' + users: + type: array + description: User IDs to assign. + example: + - einstein + - bohr + - feynman + items: + type: string + required: + - cluster + - users + responses: + '200': + $ref: '#/components/responses/CreatedAt' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/top: + get: + tags: + - search + operationId: getTopUserIds + deprecated: true + x-acl: + - admin + summary: Get top user IDs + description: > + Get the IDs of the 10 users with the highest number of records per + cluster. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + responses: + '200': + description: OK + content: + application/json: + schema: + title: getTopUserIdsResponse + type: object + description: User IDs and clusters. + properties: + topUsers: + type: array + description: >- + Key-value pairs with cluster names as keys and lists of + users with the highest number of records per cluster as + values. + items: + type: object + additionalProperties: + x-additionalPropertiesName: cluster + type: array + items: + $ref: '#/components/schemas/userId' + required: + - topUsers + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/{userID}: + get: + tags: + - search + operationId: getUserId + deprecated: true + x-acl: + - admin + summary: Retrieve user ID + description: > + Returns the user ID data stored in the mapping. + + + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + parameters: + - $ref: '#/components/parameters/UserIDInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/userId' + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + delete: + tags: + - search + operationId: removeUserId + deprecated: true + x-acl: + - admin + summary: Delete user ID + description: Deletes a user ID and its associated data from the clusters. + parameters: + - $ref: '#/components/parameters/UserIDInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + title: removeUserIdResponse + type: object + additionalProperties: false + properties: + deletedAt: + $ref: '#/components/schemas/deletedAt' + required: + - deletedAt + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters: + get: + tags: + - search + operationId: listClusters + deprecated: true + x-acl: + - admin + summary: List clusters + description: Lists the available clusters in a multi-cluster setup. + responses: + '200': + description: OK + content: + application/json: + schema: + title: listClustersResponse + type: object + description: Clusters. + properties: + topUsers: + type: array + description: >- + Key-value pairs with cluster names as keys and lists of + users with the highest number of records per cluster as + values. + items: + $ref: '#/components/schemas/clusterName' + required: + - topUsers + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/search: + post: + tags: + - search + operationId: searchUserIds + deprecated: true + x-use-read-transporter: true + x-cacheable: true + x-acl: + - admin + summary: Search for user IDs + description: > + Since it can take a few seconds to get the data from the different + clusters, + + the response isn't real-time. + + + To ensure rapid updates, the user IDs index isn't built at the same time + as the mapping. Instead, it's built every 12 hours, at the same time as + the update of user ID usage. For example, if you add or move a user ID, + the search will show an old value until the next time the mapping is + rebuilt (every 12 hours). + requestBody: + required: true + content: + application/json: + schema: + title: searchUserIdsParams + type: object + description: OK + additionalProperties: false + properties: + query: + type: string + description: >- + Query to search. The search is a prefix search with [typo + tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) + enabled. An empty query will retrieve all users. + clusterName: + $ref: '#/components/schemas/clusterName' + page: + $ref: '#/components/schemas/page' + hitsPerPage: + $ref: '#/components/schemas/hitsPerPage' + required: + - query + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchUserIdsResponse + type: object + description: userIDs data. + properties: + hits: + type: array + description: User objects that match the query. + items: + title: userHit + type: object + properties: + userID: + $ref: '#/components/schemas/userID' + clusterName: + $ref: '#/components/schemas/clusterName' + nbRecords: + $ref: '#/components/schemas/nbRecords' + dataSize: + $ref: '#/components/schemas/dataSize' + objectID: + type: string + description: userID of the requested user. Same as userID. + _highlightResult: + title: userHighlightResult + type: object + properties: + userID: + $ref: '#/components/schemas/highlightResult' + clusterName: + $ref: '#/components/schemas/highlightResult' + required: + - userID + - clusterName + required: + - userID + - clusterName + - nbRecords + - dataSize + - objectID + - _highlightResult + nbHits: + $ref: '#/components/schemas/nbHits' + page: + $ref: '#/components/schemas/page' + hitsPerPage: + $ref: '#/components/schemas/parameters_hitsPerPage' + updatedAt: + $ref: '#/components/schemas/updatedAt' + required: + - hits + - nbHits + - page + - hitsPerPage + - updatedAt + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /1/clusters/mapping/pending: + get: + tags: + - search + operationId: hasPendingMappings + deprecated: true + x-acl: + - admin + summary: Get migration and user mapping status + description: > + To determine when the time-consuming process of creating a large batch + of users or migrating users from one cluster to another is complete, + this operation retrieves the status of the process. + parameters: + - in: query + name: getClusters + description: >- + Whether to include the cluster's pending mapping state in the + response. + schema: + type: boolean + responses: + '200': + description: OK + content: + application/json: + schema: + title: hasPendingMappingsResponse + type: object + additionalProperties: false + properties: + pending: + description: >- + Whether there are clusters undergoing migration, creation, + or deletion. + type: boolean + clusters: + description: > + Cluster pending mapping state: migrating, creating, + deleting. + type: object + additionalProperties: + type: array + items: + type: string + required: + - pending + '400': + $ref: '#/components/responses/BadRequest' + '402': + $ref: '#/components/responses/FeatureNotEnabled' + '403': + $ref: '#/components/responses/MethodNotAllowed' + '404': + $ref: '#/components/responses/IndexNotFound' + /saveObjects: + get: + x-helper: true + tags: + - search + operationId: saveObjects + summary: Saves the given array of objects in the given index + description: > + Helper: Saves the given array of objects in the given index. The + `chunkedBatch` helper is used under the hood, which creates a `batch` + requests with at most 1000 objects in it. + parameters: + - in: query + name: indexName + description: The `indexName` to save `objects` into. + required: true + schema: + type: string + - in: query + name: objects + description: The objects to save in the index. + required: true + schema: + type: array + items: + type: object + - in: query + name: waitForTasks + description: >- + Whether or not we should wait until every `batch` tasks has been + processed, this operation may slow the total execution time of this + method but is more reliable. + required: false + schema: + type: boolean + default: false + - in: query + name: batchSize + description: >- + The size of the chunk of `objects`. The number of `batch` calls will + be equal to `length(objects) / batchSize`. Defaults to 1000. + required: false + schema: + type: integer + default: 1000 + - in: query + name: requestOptions + description: The request options to pass to the `batch` method. + required: false + schema: + type: object + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/batchResponse' + '400': + $ref: '#/components/responses/IndexNotFound' diff --git a/plugins/openapi/testdata/golden/algolia-ingestion.json b/plugins/openapi/testdata/golden/algolia-ingestion.json new file mode 100644 index 0000000..5804ed9 --- /dev/null +++ b/plugins/openapi/testdata/golden/algolia-ingestion.json @@ -0,0 +1,170 @@ +[ + { + "id": 1, + "fingerprint": "sha256:1e7a1a853da5f0cb442587af95ab66fcc9a20308d4295dfb287805399c7c41e7", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/tasks" + }, + "description": "Operation GET /1/tasks marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead.\",\"operationId\":\"listTasksV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/itemsPerPage\"},{\"$ref\":\"#/components/parameters/page\"},{\"$ref\":\"#/components/parameters/action\"},{\"$ref\":\"#/components/parameters/enabled\"},{\"$ref\":\"#/components/parameters/sourceID\"},{\"$ref\":\"#/components/parameters/destinationID\"},{\"$ref\":\"#/components/parameters/triggerType\"},{\"$ref\":\"#/components/parameters/taskParameters_sort\"},{\"$ref\":\"#/components/parameters/order\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"description\":\"Configured tasks and pagination information.\",\"properties\":{\"pagination\":{\"$ref\":\"#/components/schemas/Pagination\"},\"tasks\":{\"items\":{\"$ref\":\"#/components/schemas/TaskV1\"},\"type\":\"array\"}},\"required\":[\"tasks\",\"pagination\"],\"title\":\"listTasksResponseV1\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"List tasks V1\",\"tags\":[\"ingestion\"],\"x-acl\":[\"addObject\",\"deleteIndex\",\"editSettings\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:17ec64b06df87ecb1eecafcb16e9e382db116527edca15062f451c572745f3ae", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/tasks" + }, + "description": "Operation POST /1/tasks marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Creates a new task using the v1 endpoint, please use `createTask` instead.\",\"operationId\":\"createTaskV1\",\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskCreateV1\"}}},\"description\":\"Request body for creating a task.\",\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskCreateResponse\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Create a task V1\",\"tags\":[\"ingestion\"],\"x-codegen-request-body-name\":\"taskCreate\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:4e9f82a0c9e7cabbc050af7fd66c4d4e71a90c18a695f1f8464d93cf7be864db", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/tasks/search" + }, + "description": "Operation POST /1/tasks/search marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1search/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Searches for tasks using the v1 endpoint, please use `searchTasks` instead.\",\"operationId\":\"searchTasksV1\",\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskSearch\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"items\":{\"$ref\":\"#/components/schemas/TaskV1\"},\"title\":\"searchTasksResponseV1\",\"type\":\"array\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Search for tasks V1\",\"tags\":[\"ingestion\"],\"x-acl\":[\"addObject\",\"deleteIndex\",\"editSettings\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 4, + "fingerprint": "sha256:df4563501aec2e6b427964f1ee51f9881e432fc2eed2c343953d78f43d79f317", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "DELETE /1/tasks/{taskID}" + }, + "description": "Operation DELETE /1/tasks/{taskID} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1{taskID}/delete", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Deletes a task by its ID using the v1 endpoint, please use `deleteTask` instead.\",\"operationId\":\"deleteTaskV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/pathTaskID\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/DeleteResponse\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Delete a task\",\"tags\":[\"ingestion\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 5, + "fingerprint": "sha256:f53f0abf4924f3abed31f2d0d50b71e30c77295dc2b2a4fcfc426aeb64b3cf4e", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/tasks/{taskID}" + }, + "description": "Operation GET /1/tasks/{taskID} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1{taskID}/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Retrieves a task by its ID using the v1 endpoint, please use `getTask` instead.\",\"operationId\":\"getTaskV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/pathTaskID\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskV1\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Retrieve a task V1\",\"tags\":[\"ingestion\"],\"x-acl\":[\"addObject\",\"deleteIndex\",\"editSettings\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 6, + "fingerprint": "sha256:7dc53327e9239847c43e0d1fc140670139b4b755711875cc00b2d0126973cf69", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "PATCH /1/tasks/{taskID}" + }, + "description": "Operation PATCH /1/tasks/{taskID} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1{taskID}/patch", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Updates a task by its ID using the v1 endpoint, please use `updateTask` instead.\",\"operationId\":\"updateTaskV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/pathTaskID\"}],\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskUpdateV1\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskUpdateResponse\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Update a task V1\",\"tags\":[\"ingestion\"],\"x-codegen-request-body-name\":\"taskUpdate\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 7, + "fingerprint": "sha256:fbb43f00dfdd75418da24e766a926b0e48b824e8b6a000340a3a82ed87ec654f", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "PUT /1/tasks/{taskID}/enable" + }, + "description": "Operation PUT /1/tasks/{taskID}/enable marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1{taskID}~1enable/put", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Enables a task using the v1 endpoint, please use `enableTask` instead.\",\"operationId\":\"enableTaskV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/pathTaskID\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TaskUpdateResponse\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Enable a task V1\",\"tags\":[\"ingestion\"],\"x-acl\":[\"addObject\",\"deleteIndex\",\"editSettings\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 8, + "fingerprint": "sha256:cefabf61328b95d67f3187e183dae0b8d54407d98b09b0d018e15f6b3d5f0d69", + "api": "algolia-ingestion", + "version": "2025-01-22", + "previous_version": "2025-01-07", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/tasks/{taskID}/run" + }, + "description": "Operation POST /1/tasks/{taskID}/run marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-22-232affcac/specs/bundled/ingestion.yml", + "source_pointer": "/paths/~11~1tasks~1{taskID}~1run/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Runs a task using the v1 endpoint, please use `runTask` instead. You can check the status of task runs with the observability endpoints.\",\"operationId\":\"runTaskV1\",\"parameters\":[{\"$ref\":\"#/components/parameters/pathTaskID\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/RunResponse\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"}},\"summary\":\"Run a task V1\",\"tags\":[\"ingestion\"],\"x-acl\":[\"addObject\",\"deleteIndex\",\"editSettings\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/openapi/testdata/golden/algolia-search.json b/plugins/openapi/testdata/golden/algolia-search.json new file mode 100644 index 0000000..584aed1 --- /dev/null +++ b/plugins/openapi/testdata/golden/algolia-search.json @@ -0,0 +1,191 @@ +[ + { + "id": 1, + "fingerprint": "sha256:98c98629cbe46426329ba9fb60630c8bcc4194b191545aa008011f07252b5f5b", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/clusters" + }, + "description": "Operation GET /1/clusters marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Lists the available clusters in a multi-cluster setup.\",\"operationId\":\"listClusters\",\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"description\":\"Clusters.\",\"properties\":{\"topUsers\":{\"description\":\"Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values.\",\"items\":{\"$ref\":\"#/components/schemas/clusterName\"},\"type\":\"array\"}},\"required\":[\"topUsers\"],\"title\":\"listClustersResponse\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"List clusters\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:300b57a1485499d6a5fe3ff47e73b3dae695e2354ce20af1984db2345eb85334", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/clusters/mapping" + }, + "description": "Operation GET /1/clusters/mapping marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Lists the userIDs assigned to a multi-cluster application.\\n\\nSince it can take a few seconds to get the data from the different clusters,\\nthe response isn't real-time.\\n\",\"operationId\":\"listUserIds\",\"parameters\":[{\"$ref\":\"#/components/parameters/Page\"},{\"$ref\":\"#/components/parameters/HitsPerPage\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"description\":\"User ID data.\",\"properties\":{\"userIDs\":{\"description\":\"User IDs.\",\"items\":{\"$ref\":\"#/components/schemas/userId\"},\"type\":\"array\"}},\"required\":[\"userIDs\"],\"title\":\"listUserIdsResponse\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"List user IDs\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:cef12aebf4a4a83fccea8645a0cf33c1d26468c547db8f103763278e78d38bca", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/clusters/mapping" + }, + "description": "Operation POST /1/clusters/mapping marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Assigns or moves a user ID to a cluster.\\n\\nThe time it takes to move a user is proportional to the amount of data linked to the user ID.\\n\",\"operationId\":\"assignUserId\",\"parameters\":[{\"$ref\":\"#/components/parameters/UserIDInHeader\"}],\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"description\":\"Assign userID parameters.\",\"properties\":{\"cluster\":{\"$ref\":\"#/components/schemas/clusterName\"}},\"required\":[\"cluster\"],\"title\":\"assignUserIdParams\",\"type\":\"object\"}}},\"required\":true},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/CreatedAt\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Assign or move a user ID\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 4, + "fingerprint": "sha256:3e264c501d2346c87750b601f3ec19cd16db54f253ebac636d2d4575f754cb76", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/clusters/mapping/batch" + }, + "description": "Operation POST /1/clusters/mapping/batch marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1batch/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Assigns multiple user IDs to a cluster.\\n\\n**You can't move users with this operation**.\\n\",\"operationId\":\"batchAssignUserIds\",\"parameters\":[{\"$ref\":\"#/components/parameters/UserIDInHeader\"}],\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"description\":\"Assign userID parameters.\",\"properties\":{\"cluster\":{\"$ref\":\"#/components/schemas/clusterName\"},\"users\":{\"description\":\"User IDs to assign.\",\"example\":[\"einstein\",\"bohr\",\"feynman\"],\"items\":{\"type\":\"string\"},\"type\":\"array\"}},\"required\":[\"cluster\",\"users\"],\"title\":\"batchAssignUserIdsParams\",\"type\":\"object\"}}},\"required\":true},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/CreatedAt\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Assign multiple userIDs\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 5, + "fingerprint": "sha256:3be2d780b21e3a2cac8cfc73c48a91171e7b77335c19d87f400d9c8618dd6e04", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/clusters/mapping/pending" + }, + "description": "Operation GET /1/clusters/mapping/pending marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1pending/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.\\n\",\"operationId\":\"hasPendingMappings\",\"parameters\":[{\"description\":\"Whether to include the cluster's pending mapping state in the response.\",\"in\":\"query\",\"name\":\"getClusters\",\"schema\":{\"type\":\"boolean\"}}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"properties\":{\"clusters\":{\"additionalProperties\":{\"items\":{\"type\":\"string\"},\"type\":\"array\"},\"description\":\"Cluster pending mapping state: migrating, creating, deleting.\\n\",\"type\":\"object\"},\"pending\":{\"description\":\"Whether there are clusters undergoing migration, creation, or deletion.\",\"type\":\"boolean\"}},\"required\":[\"pending\"],\"title\":\"hasPendingMappingsResponse\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Get migration and user mapping status\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 6, + "fingerprint": "sha256:9ef87419d739219194a79e3ba13a5c06c59d1ff0a6452a04c8a6200af27f87d5", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /1/clusters/mapping/search" + }, + "description": "Operation POST /1/clusters/mapping/search marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1search/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Since it can take a few seconds to get the data from the different clusters,\\nthe response isn't real-time.\\n\\nTo ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).\\n\",\"operationId\":\"searchUserIds\",\"requestBody\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"description\":\"OK\",\"properties\":{\"clusterName\":{\"$ref\":\"#/components/schemas/clusterName\"},\"hitsPerPage\":{\"$ref\":\"#/components/schemas/hitsPerPage\"},\"page\":{\"$ref\":\"#/components/schemas/page\"},\"query\":{\"description\":\"Query to search. The search is a prefix search with [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) enabled. An empty query will retrieve all users.\",\"type\":\"string\"}},\"required\":[\"query\"],\"title\":\"searchUserIdsParams\",\"type\":\"object\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"description\":\"userIDs data.\",\"properties\":{\"hits\":{\"description\":\"User objects that match the query.\",\"items\":{\"properties\":{\"_highlightResult\":{\"properties\":{\"clusterName\":{\"$ref\":\"#/components/schemas/highlightResult\"},\"userID\":{\"$ref\":\"#/components/schemas/highlightResult\"}},\"required\":[\"userID\",\"clusterName\"],\"title\":\"userHighlightResult\",\"type\":\"object\"},\"clusterName\":{\"$ref\":\"#/components/schemas/clusterName\"},\"dataSize\":{\"$ref\":\"#/components/schemas/dataSize\"},\"nbRecords\":{\"$ref\":\"#/components/schemas/nbRecords\"},\"objectID\":{\"description\":\"userID of the requested user. Same as userID.\",\"type\":\"string\"},\"userID\":{\"$ref\":\"#/components/schemas/userID\"}},\"required\":[\"userID\",\"clusterName\",\"nbRecords\",\"dataSize\",\"objectID\",\"_highlightResult\"],\"title\":\"userHit\",\"type\":\"object\"},\"type\":\"array\"},\"hitsPerPage\":{\"$ref\":…", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 7, + "fingerprint": "sha256:933c2581c2ee22647cfc56e69694b562523e91658f8f80d14845f1d201921fdb", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/clusters/mapping/top" + }, + "description": "Operation GET /1/clusters/mapping/top marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1top/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Get the IDs of the 10 users with the highest number of records per cluster.\\n\\nSince it can take a few seconds to get the data from the different clusters,\\nthe response isn't real-time.\\n\",\"operationId\":\"getTopUserIds\",\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"description\":\"User IDs and clusters.\",\"properties\":{\"topUsers\":{\"description\":\"Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values.\",\"items\":{\"additionalProperties\":{\"items\":{\"$ref\":\"#/components/schemas/userId\"},\"type\":\"array\",\"x-additionalPropertiesName\":\"cluster\"},\"type\":\"object\"},\"type\":\"array\"}},\"required\":[\"topUsers\"],\"title\":\"getTopUserIdsResponse\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Get top user IDs\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 8, + "fingerprint": "sha256:86c3bf5e28959fbc84b0258d5df3824066ef30c2f1f87fb50070cf4d1f29736f", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "DELETE /1/clusters/mapping/{userID}" + }, + "description": "Operation DELETE /1/clusters/mapping/{userID} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1{userID}/delete", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Deletes a user ID and its associated data from the clusters.\",\"operationId\":\"removeUserId\",\"parameters\":[{\"$ref\":\"#/components/parameters/UserIDInPath\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"additionalProperties\":false,\"properties\":{\"deletedAt\":{\"$ref\":\"#/components/schemas/deletedAt\"}},\"required\":[\"deletedAt\"],\"title\":\"removeUserIdResponse\",\"type\":\"object\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Delete user ID\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 9, + "fingerprint": "sha256:590237cb63bae5005e8bcbcf50ee7e4e15a1fd2ec1b324788bc960e493a87b8a", + "api": "algolia-search", + "version": "2025-04-01", + "previous_version": "2025-03-25", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /1/clusters/mapping/{userID}" + }, + "description": "Operation GET /1/clusters/mapping/{userID} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-04-01-c19ee6afb/specs/bundled/search.yml", + "source_pointer": "/paths/~11~1clusters~1mapping~1{userID}/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"Returns the user ID data stored in the mapping.\\n\\nSince it can take a few seconds to get the data from the different clusters,\\nthe response isn't real-time.\\n\",\"operationId\":\"getUserId\",\"parameters\":[{\"$ref\":\"#/components/parameters/UserIDInPath\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/userId\"}}},\"description\":\"OK\"},\"400\":{\"$ref\":\"#/components/responses/BadRequest\"},\"402\":{\"$ref\":\"#/components/responses/FeatureNotEnabled\"},\"403\":{\"$ref\":\"#/components/responses/MethodNotAllowed\"},\"404\":{\"$ref\":\"#/components/responses/IndexNotFound\"}},\"summary\":\"Retrieve user ID\",\"tags\":[\"search\"],\"x-acl\":[\"admin\"]}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/providers/README.md b/providers/README.md index b4a7c14..e8c3c74 100644 --- a/providers/README.md +++ b/providers/README.md @@ -16,6 +16,7 @@ One page per plugin id: `providers/.md`. Start from [`_template.md`](_templ | [gitlab.md](gitlab.md) | `gitlab` | `openapi` | | [vercel.md](vercel.md) | `vercel` | `openapi` | | [supabase.md](supabase.md) | `supabase` | `openapi` | +| [algolia.md](algolia.md) | `algolia-search`, `algolia-ingestion`, `algolia-recommend` | `openapi` | | [openai-models.md](openai-models.md) | `openai-models` | `retirements` | | [anthropic-models.md](anthropic-models.md) | `anthropic-models` | `retirements` | | [anthropic.md](anthropic.md) | `anthropic` | `migrationguide` | diff --git a/providers/algolia.md b/providers/algolia.md new file mode 100644 index 0000000..9158969 --- /dev/null +++ b/providers/algolia.md @@ -0,0 +1,52 @@ +# Algolia (`algolia-search`, `algolia-ingestion`, `algolia-recommend`) + +## What it watches + +Three of Algolia's REST APIs, one plugin each: the Search API (`algolia-search`), the Ingestion API (`algolia-ingestion`) and the Recommend API (`algolia-recommend`). Each reports operations Algolia marks deprecated, and removals of operations it had marked deprecated, between two releases of that API's OpenAPI spec. + +Format plugin: `openapi` (`plugins/openapi`), with `adapter.Algolia`. + +## Why this source + +- **Source:** `specs/bundled/.yml` in [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation), pinned to a release tag (`https://raw.githubusercontent.com/algolia/api-clients-automation//specs/bundled/search.yml`). The newest tag comes from the GitHub refs API. Checked on 2026-11-19. +- **Why this one:** + - It's the spec Algolia generates every API client from (Python, JS, Go, …), so it's the API as Algolia's own clients see it. + - It has 186 release tags from 2023-08-22 to 2026-11-17 (`released-2026-11-17-31c309fe2a`), and a tag never changes. + - Deprecations use the `deprecated` flag, sometimes with the replacement in the description ("please use `getTasks` instead"). +- **Alternatives considered:** + - **The [changelog](https://changelog.algolia.com),** hosted on AnnounceKit. It's product news, and its feed URLs return the HTML page, not a feed. + - **There's no deprecations page** (`/doc/guides/getting-started/deprecations/` is a 404). + - **`specs/major-breaking-changes-rename.json`** maps client method names from the last major version of the clients to the current ones. It's a one-time migration map, not a changelog. + - **The API clients' own changelogs.** They're generated from the same specs. +- **Quote:** "Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead." (`GET /1/tasks`, deprecated in the Ingestion API spec in `released-2025-01-22-232affcac`) + +## How the provider announces changes + +- **No API version beyond `/1/` in the paths.** Each API client has its own version numbers, so the event's `version` is the date of the spec release (`2025-04-01`). +- **The specs get a release a few times a week.** Deprecations are rare: in the history, 9 in the Search API and 9 in the Ingestion API, none in Recommend. + +## What the plugin reads and ignores + +- **Reads:** each API's spec at the newest release tag, diffed against the last one. Two events come out of it: + - **Deprecations:** an operation that gains the `deprecated` flag. The event quotes the whole operation, so a replacement Algolia names in the description is in the excerpt. + - **Removals (breaking):** an operation that leaves the spec after the previous release had marked it deprecated. +- **Finds the newest release** by its date. A day can have several releases (three on 2024-09-19), and the commit in a tag says nothing about their order, so same-day releases are ordered by their commit's date. +- **Ignores entries that describe only an API client, not the REST API:** + - helpers marked `x-helper: true`: `/saveObjects`, `/waitForTask`, `/replaceAllObjects`, … (16 in the Search API); + - the custom-request methods for any path (`customGet`, `customPost`, `customPut`, `customDelete` on `/{path}`). +- **Ignores everything else:** + - **Removals of operations that were never deprecated.** 17 removals in the history, none deprecated first. 13 were the client-only entries above: the custom-request methods `/1{path}` in all three specs, which became `/{path}` on 2024-03-25, and `/saveObjects`. The other 4 were Ingestion API operations: GET and POST `/1/transformations/models`, `/1/transformations/copilot`, and `/1/sources/{sourceID}/discover`. + - **Property changes, and new operations.** +- From 2023-08-22 to 2026-11-17 this keeps 18 events, all deprecations: + - **Search API:** the 9 multi-cluster operations under `/1/clusters` (2025-04-01). + - **Ingestion API:** 8 v1 `/1/tasks` operations (2025-01-22) and `PUT /1/tasks/{taskID}/disable` (2024-07-26). +- **The golden tests** replay the Search and Ingestion deprecations. The drop tests replay the `/1/transformations/models` removal and, for `algolia-recommend`, the custom-request move of 2024-03-25. + +## Known gaps + +- **Only three APIs are watched.** Analytics, Insights, A/B testing, Query Suggestions, Personalization, Monitoring and others have specs in the same repo, but no deprecations in them yet. +- **Removals Algolia didn't mark first aren't events,** even if the endpoint really went away. +- **A "removed" event means removed from the spec.** If a deprecated operation, such as the v1 `/1/tasks` ones, leaves the API clients' spec while Algolia still serves it, the plugin reports it removed. `vercel` and `supabase` share this. +- **Changes to the API clients themselves aren't covered:** method renames between major versions, the helpers. +- **Two releases on one day share a `version`.** +- **The patch-it client can't place these events yet.** Their `version` is a date, because the API has no version. It needs the same rule for date-versioned API events that `cloudflare`'s and `supabase`'s need.