Skip to content

Add contexts and sync Schema Registry API spec to source#65

Open
kbatuigas wants to merge 5 commits intomainfrom
DOC-2094-schema-registry-api-schema-contexts
Open

Add contexts and sync Schema Registry API spec to source#65
kbatuigas wants to merge 5 commits intomainfrom
DOC-2094-schema-registry-api-schema-contexts

Conversation

@kbatuigas
Copy link
Copy Markdown
Contributor

This pull request introduces significant updates to the Schema Registry API documentation and specification, primarily to support and document the new "context" feature, which allows for isolated namespaces for schemas and configuration. It also adds new API endpoints, enhances parameter descriptions, and updates response schemas to improve clarity and usability.

Support for Contexts and Qualified Subjects:

  • Added detailed descriptions to path and query parameters throughout schema-registry.json to explain how to use context-qualified subjects (e.g., [:.<context>:]<subject>) for scoping operations, including for getting, setting, and deleting configs and modes, as well as for subject-related endpoints. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]
  • Updated parameter descriptions for endpoints that accept a subjectPrefix to clarify how context-qualified and wildcard prefixes work.
  • Added a new documentation section in add-external-docs.yaml explaining contexts and linking to relevant Redpanda documentation.

New and Enhanced API Endpoints:

  • Added a new endpoint /schemas/ids/{id}/schema to retrieve the raw schema string by ID, with support for context-qualified subject lookup and format options.
  • Updated several endpoints to accept new query parameters, such as subject (qualified subject lookup) and referenceFormat (qualified/unqualified references), improving flexibility when searching or retrieving schemas. [1] [2] [3]

Response Schema and Request Body Updates:

  • Switched several response and request body references to new or renamed schema definitions (e.g., schema_def_response, schema_def_request, stored_schema_response, stored_schema_request, post_subject_versions_response, get_subject_versions_version_response) for improved clarity and future extensibility. [1] [2] [3] [4] [5] [6] [7]

Versioning:

  • Updated the API version in the OpenAPI/Swagger specification from 1.1.2 to 1.2.0.

These changes collectively bring the Schema Registry API documentation up to date with the latest product features and improve its usability for developers working with contexts and qualified subjects.

@kbatuigas kbatuigas requested a review from a team as a code owner April 17, 2026 16:01
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0602341-f057-43f7-85c6-14c34413879a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request bumps the Schema Registry API specification from version 1.1.2 to 1.2.0 with two main changes. First, it extends the API documentation with an external docs overlay describing Redpanda's Schema Registry contexts feature (available in v26.1+), explaining context scoping via path parameters and context-qualified subjects. Second, it updates the OpenAPI specification to introduce context management endpoints (GET /contexts, DELETE /contexts/{context}), a new schema retrieval endpoint (GET /schemas/ids/{id}/schema), and enhanced parameter documentation for context-aware subject handling. Request and response schema definitions are refactored to distinguish between request and response shapes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Schema-Registry: Update for v25.2.2 #19 — Modifies the same OpenAPI specification file with overlapping schema and endpoint signature changes (GET /schemas/ids/{id} response refs and POST /subjects/{subject}/versions body schema updates).

Suggested reviewers

  • pgellert
  • Feediver1
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add contexts and sync Schema Registry API spec to source' accurately summarizes the main changes: introducing context support and updating the API specification.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering contexts, new endpoints, parameter updates, schema changes, and versioning.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DOC-2094-schema-registry-api-schema-contexts

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

🤖 Redpanda/schema-registry API structural change detected

Preview documentation

Structural change details

Added (3)

  • DELETE /contexts/{context}
  • GET /contexts
  • GET /schemas/ids/{id}/schema

Modified (7)

  • GET /schemas/ids/{id}
    • Response modified: 200
      • Content type modified: application/vnd.schemaregistry.v1+json
        • Property added: metadata
      • Content type modified: application/vnd.schemaregistry+json
        • Property added: metadata
      • Content type modified: application/json
        • Property added: metadata
    • Query parameters added: subject, referenceFormat
  • GET /schemas/ids/{id}/subjects
    • Query parameter added: subject
  • GET /schemas/ids/{id}/versions
    • Query parameter added: subject
  • GET /subjects/{subject}/versions/{version}
    • Response modified: 200
      • Content type modified: application/vnd.schemaregistry.v1+json
        • Properties added: metadata, deleted
      • Content type modified: application/vnd.schemaregistry+json
        • Properties added: metadata, deleted
      • Content type modified: application/json
        • Properties added: metadata, deleted
  • POST /compatibility/subjects/{subject}/versions/{version}
    • Content type modified: application/vnd.schemaregistry.v1+json
      • Property added: metadata
    • Content type modified: application/vnd.schemaregistry+json
      • Property added: metadata
    • Content type modified: application/json
      • Property added: metadata
  • POST /subjects/{subject}
    • Content type modified: application/vnd.schemaregistry.v1+json
      • Property added: metadata
    • Content type modified: application/vnd.schemaregistry+json
      • Property added: metadata
    • Content type modified: application/json
      • Property added: metadata
    • Response modified: 200
      • Content type modified: application/vnd.schemaregistry.v1+json
        • Property added: metadata
      • Content type modified: application/vnd.schemaregistry+json
        • Property added: metadata
      • Content type modified: application/json
        • Property added: metadata
  • POST /subjects/{subject}/versions
    • Content type modified: application/vnd.schemaregistry.v1+json
      • Property added: metadata
    • Content type modified: application/vnd.schemaregistry+json
      • Property added: metadata
    • Content type modified: application/json
      • Property added: metadata
    • Response modified: 200
      • Content type modified: application/vnd.schemaregistry.v1+json
        • Properties added: version, schemaType, references, metadata, schema
      • Content type modified: application/vnd.schemaregistry+json
        • Properties added: version, schemaType, references, metadata, schema
      • Content type modified: application/json
        • Properties added: version, schemaType, references, metadata, schema
Powered by Bump.sh

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
schema-registry/schema-registry.json (1)

469-475: Use one canonical context-qualified subject syntax in docs

The subject-query examples use "<:.context:...>", while the rest of the spec consistently documents :.<context>: style. Please normalize these descriptions to one format to avoid client confusion.

Also applies to: 530-535, 583-588, 646-651

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@schema-registry/schema-registry.json` around lines 469 - 475, Update the
"subject" query parameter descriptions to use the canonical context-qualified
syntax :.<context>: (and :.<context>:subject when referencing subject-specific
lookup) instead of the inconsistent "<:.context:...>" form; edit the "subject"
parameter descriptions (the JSON objects with "name": "subject") at the noted
occurrences so they consistently show :.<context>: and :.<context>:subject
examples and wording throughout the schema-registry.json.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@schema-registry/schema-registry.json`:
- Around line 1693-1698: The schema_metadata_request uses a oneOf inside
additionalProperties which is invalid for OpenAPI 2.0; remove the oneOf and
replace it with a single schema that expresses the allowed primitive types (for
example use "type": ["string","number","boolean"]) under additionalProperties so
the spec validates and SDK/doc tooling can process schema_metadata_request
correctly.

---

Nitpick comments:
In `@schema-registry/schema-registry.json`:
- Around line 469-475: Update the "subject" query parameter descriptions to use
the canonical context-qualified syntax :.<context>: (and :.<context>:subject
when referencing subject-specific lookup) instead of the inconsistent
"<:.context:...>" form; edit the "subject" parameter descriptions (the JSON
objects with "name": "subject") at the noted occurrences so they consistently
show :.<context>: and :.<context>:subject examples and wording throughout the
schema-registry.json.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03a25645-9d16-46e8-9b50-0e6aa607bd7e

📥 Commits

Reviewing files that changed from the base of the PR and between 1da6c4e and 1b0eb62.

📒 Files selected for processing (2)
  • schema-registry/overlays/add-external-docs.yaml
  • schema-registry/schema-registry.json

Comment thread schema-registry/schema-registry.json Outdated
Comment on lines +1693 to +1698
"additionalProperties": {
"oneOf": [
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean" }
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python -m pip install --quiet openapi-spec-validator==0.7.1

python - <<'PY'
import json
import sys
from openapi_spec_validator import validate_spec

path = "schema-registry/schema-registry.json"
with open(path, "r", encoding="utf-8") as f:
    spec = json.load(f)

try:
    validate_spec(spec)
    print("VALID:", path)
except Exception as e:
    print("INVALID:", path)
    print(type(e).__name__ + ":", e)
    sys.exit(1)
PY

Repository: redpanda-data/api-docs

Length of output: 953


Remove oneOf from additionalProperties in schema_metadata_request

Lines 1693-1698 use oneOf inside additionalProperties, which violates OpenAPI 2.0 schema constraints and breaks spec validation. This prevents SDK generation and documentation tooling from processing the schema correctly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@schema-registry/schema-registry.json` around lines 1693 - 1698, The
schema_metadata_request uses a oneOf inside additionalProperties which is
invalid for OpenAPI 2.0; remove the oneOf and replace it with a single schema
that expresses the allowed primitive types (for example use "type":
["string","number","boolean"]) under additionalProperties so the spec validates
and SDK/doc tooling can process schema_metadata_request correctly.

Replace oneOf (string/number/boolean) with type: string in
additionalProperties of schema_metadata_request. The oneOf keyword
is not part of the Swagger 2.0 spec and breaks SDK generators.
Values are converted to strings by the server, so type: string
accurately reflects the API behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kbatuigas kbatuigas requested a review from pgellert April 17, 2026 19:56
- Fix version phrasing in overlay: "v26.1 and later" -> "version 26.1 or later"
- Fix comma splice in schema_metadata_request description
- Add missing description to defaultToGlobal on GET /config/{subject}
- Clarify "subject-version" -> "subject-version pairs" in summary
- Make POST /security/acls description add value beyond the summary

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread schema-registry/overlays/add-external-docs.yaml Outdated
"info": {
"title": "Redpanda Schema Registry API",
"version": "1.1.2"
"version": "1.2.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the changes in schema-registry.json are just a straight copy-paste from the redpanda repo, right? In which case, this looks good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pgellert there are a few little patches where this diverges from the source repo

Do these still sound good?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all looks good and makes sense, thanks @kbatuigas!

Co-authored-by: Gellért Peresztegi-Nagy <pereszteginagy.gellert@gmail.com>
@kbatuigas kbatuigas requested a review from pgellert April 22, 2026 16:58
Copy link
Copy Markdown
Contributor

@micheleRP micheleRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs review — findings

Context: reviewed against docs-team-standards and prior review feedback. The rename/refactor and new-endpoint additions land cleanly; below are the items that warrant attention before merge plus two cross-repo impacts worth flagging.

Must fix

Inconsistent context-qualified-subject syntax in 4 query-parameter descriptions

CodeRabbit's remaining unresolved nitpick is worth taking, and I'd rate it higher than "nitpick" — it will confuse API consumers. The new subject query-parameter descriptions use a different placeholder convention than the rest of the spec:

  • New query params (4 occurrences, approx. lines 469–475, 530–535, 583–588, 646–651) currently read:

    Optional qualified subject to search for the schema under. Use <:.context:> for context-only lookup, or <:.context:subject> to also verify the schema is associated with that subject. Defaults to searching the default context if unspecified.

    Here the entire token is wrapped in <…> and context / subject are not placeholder variables.

  • Everywhere else (every path param, schema_reference.subject, and the overlay) uses:

    Use [:.<context>:]<subject> for context-qualified subjects, or just <subject> for the default context.

    Here <context> / <subject> are the variable placeholders and the square brackets mark the optional qualifier.

Suggested rewrite for all four occurrences:

Qualified subject to search for the schema under. Use :.<context>: for context-only lookup, or :.<context>:<subject> to also verify the schema is associated with that subject. Defaults to searching the default context if unspecified.

Suggestions

1. "Optional" is redundant in the new query-param descriptions

The new subject and referenceFormat descriptions lead with "Optional…", but the parameters are already declared "required": false, and no other optional parameter in this spec opens with the word. Consider dropping "Optional " for consistency with the surrounding spec. Style-only.

2. Parenthetical in overlay parses ambiguously

Current text in schema-registry/overlays/add-external-docs.yaml:

See the Redpanda Cloud (configurable only in BYOC and Dedicated clusters) or Redpanda Self-Managed documentation for details.

The "(configurable only in BYOC and Dedicated clusters)" clause is attached to the Cloud link, but a reader may take it as a condition on the whole feature. Consider moving it into its own sentence, e.g.:

In Redpanda Cloud, contexts are configurable only in BYOC and Dedicated clusters. See the Redpanda Cloud or Redpanda Self-Managed documentation for details.

Impact on other files (not in this PR)

1. Overlay links are currently 404 — coordinate with the docs PRs

The overlay paragraph links to:

  • https://docs.redpanda.com/current/manage/schema-reg/schema-reg-contexts/
  • https://docs.redpanda.com/redpanda-cloud/manage/schema-reg/schema-reg-contexts/

Both return HTTP 404 at the moment (verified via curl -sI). The source pages live in open PRs:

Worth coordinating so this PR merges after both docs PRs publish, or confirming the api-docs publication pipeline realistically trails the docs rollouts.

2. Renamed schema definitions are a breaking change for spec consumers

The refactor renames several top-level definitions:

  • schema_defschema_def_request / schema_def_response
  • stored_schemastored_schema_request / stored_schema_response
  • New post_subject_versions_response and get_subject_versions_version_response

This is a breaking rename for anyone generating SDKs or referencing these definitions externally. Not an issue in this PR itself, but worth a changelog or release-note entry wherever this spec is published downstream.

@kbatuigas
Copy link
Copy Markdown
Contributor Author

Status:

  • Inconsistent context-qualified subject syntax: Fixed
  • "Optional" redundant in query param descriptions: Fixed
  • Overlay parenthetical parses ambiguously: Fixed
  • Overlay links are 404: Expected (docs PRs haven't merged yet)
  • Renamed definitions breaking change: Bump.sh automatically indicates these (see comment)

@kbatuigas kbatuigas requested a review from micheleRP April 23, 2026 01:12
Copy link
Copy Markdown
Contributor

@micheleRP micheleRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants