Skip to content

Support for PCF in Avro#1091

Closed
kbatuigas wants to merge 2 commits intomainfrom
DOC-43-Document-Schema-Registry-support-for-Parsing-Canonical-Form-in-Avro-23.2
Closed

Support for PCF in Avro#1091
kbatuigas wants to merge 2 commits intomainfrom
DOC-43-Document-Schema-Registry-support-for-Parsing-Canonical-Form-in-Avro-23.2

Conversation

@kbatuigas
Copy link
Contributor

@kbatuigas kbatuigas commented Apr 28, 2025

Description

This pull request adds a new section to the Schema Registry documentation to explain how Avro normalization is handled in Redpanda. The update clarifies the transformation process and references the Avro specification.

Support for PCF was added in RP version 23.2.

Documentation updates:

  • modules/manage/pages/schema-reg/schema-reg-overview.adoc: Added a new subsection titled "Avro normalization" to describe how Redpanda transforms Avro schemas into Parsing Canonical Form, with a note that the STRIP transformation is not applied. A link to the relevant section of the Avro specification is included.

Resolves https://redpandadata.atlassian.net/browse/
Review deadline: 29 Apr

Page previews

https://deploy-preview-1091--redpanda-docs-preview.netlify.app/current/manage/schema-reg/schema-reg-overview/#avro-normalization

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

Summary by CodeRabbit

  • Documentation
    • Added a new "Avro normalization" subsection to clarify how Avro schemas are normalized, specifying the use of Parsing Canonical Form and noting the exception regarding the STRIP transformation.

@kbatuigas kbatuigas requested a review from a team as a code owner April 28, 2025 20:26
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 28, 2025

Walkthrough

The documentation for the Redpanda Schema Registry was updated to include a new subsection under the "Normalization" section. This subsection, titled "Avro normalization," clarifies that Avro schemas are normalized using the Parsing Canonical Form as specified by the Avro standard, except for the omission of the STRIP transformation. No changes were made to code, logic, or control flow.

Changes

File(s) Change Summary
modules/manage/pages/schema-reg/schema-reg-overview.adoc Added documentation subsection "Avro normalization" detailing the normalization process for Avro schemas.

Poem

In docs a new tale is spun,
Of Avro schemas, normalization begun.
Parsing Canonical Form, but STRIP left behind,
Clarity for users, with standards aligned.
The Registry hops forward, its knowledge refined!
🐇📖


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fa9f59 and 4e3974a.

📒 Files selected for processing (1)
  • modules/manage/pages/schema-reg/schema-reg-overview.adoc (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/manage/pages/schema-reg/schema-reg-overview.adoc
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - redpanda-docs-preview
  • GitHub Check: Header rules - redpanda-docs-preview
  • GitHub Check: Pages changed - redpanda-docs-preview

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Apr 28, 2025

Deploy Preview for redpanda-docs-preview ready!

Name Link
🔨 Latest commit 4e3974a
🔍 Latest deploy log https://app.netlify.com/sites/redpanda-docs-preview/deploys/680fe76e55600b0008238151
😎 Deploy Preview https://deploy-preview-1091--redpanda-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
modules/manage/pages/schema-reg/schema-reg-overview.adoc (1)

26-29: Refine link versioning, acronym usage, and heading hierarchy

To further strengthen this section, consider:

  1. Introducing the acronym on first use: “Parsing Canonical Form (PCF)”.
  2. Replacing the ++version++ placeholder in the URL with a defined attribute (e.g., {avro-spec-version}) or hardcoding the exact spec version to guarantee the link resolves correctly.
  3. Ensuring consistent nesting: convert the bold “Normalization” term into an AsciiDoc heading (e.g., === Normalization) so that === Avro normalization (or ==== Avro normalization) is semantically and visually nested under it.

Example diff for points 1 & 2:

=== Avro normalization
-When normalizing an Avro schema, Redpanda transforms the schema into Parsing Canonical Form as defined in the https://avro.apache.org/docs/++version++/specification/#transforming-into-parsing-canonical-form[Avro specification], with the exception that it does not apply the STRIP transformation.
+When normalizing an Avro schema, Redpanda transforms the schema into Parsing Canonical Form (PCF) as defined in the https://avro.apache.org/docs/{avro-spec-version}/specification/#transforming-into-parsing-canonical-form[Avro specification], with the exception that it does not apply the STRIP transformation.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e1e840 and 0fa9f59.

📒 Files selected for processing (1)
  • modules/manage/pages/schema-reg/schema-reg-overview.adoc (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - redpanda-docs-preview
  • GitHub Check: Header rules - redpanda-docs-preview
  • GitHub Check: Pages changed - redpanda-docs-preview
🔇 Additional comments (1)
modules/manage/pages/schema-reg/schema-reg-overview.adoc (1)

26-29: Well done: clear "Avro normalization" subsection

The new content succinctly explains that Redpanda normalizes Avro schemas to Parsing Canonical Form and explicitly omits the STRIP transformation, directly referencing the Avro spec. This aligns perfectly with the PR objective.

@kbatuigas kbatuigas requested a review from BenPope April 28, 2025 20:41

=== Avro normalization

When normalizing an Avro schema, Redpanda transforms the schema into Parsing Canonical Form as defined in the https://avro.apache.org/docs/++version++/specification/#transforming-into-parsing-canonical-form[Avro specification^], with the exception that it does not apply the STRIP transformation.
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment, the link versioning is not working, and so the link is broken.

Copy link
Contributor

@asimms41 asimms41 left a comment

Choose a reason for hiding this comment

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

Just the broken link to fix.


=== Avro normalization

When normalizing an Avro schema, Redpanda transforms the schema into Parsing Canonical Form as defined in the https://avro.apache.org/docs/++version++/specification/#transforming-into-parsing-canonical-form[Avro specification^], with the exception that it does not apply the STRIP transformation.
Copy link
Member

@BenPope BenPope Apr 29, 2025

Choose a reason for hiding this comment

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

Neither Redpanda or Confluent transform it into PCN.

[PRIMITIVES] Convert primitive schemas to their simple form (e.g., int instead of {"type":"int"}).

Yes, this is true

[FULLNAMES] Replace short names with fullnames, using applicable namespaces to do so. Then eliminate namespace attributes, which are now redundant.

All names are converted to fullnames, with redundant namespace included.

[STRIP] Keep only attributes that are relevant to parsing data, which are: type, name, fields, symbols, items, values, size. Strip all others (e.g., doc and aliases).

I think aliases are actually removed since the parser didn't support them (It's not intentional, I think a library update may support them now, which we should probably pull in).

[ORDER] Order the appearance of fields of JSON objects as follows: name, type, fields, symbols, items, values, size. For example, if an object has type, name, and size fields, then the name field should appear first, followed by the type and then the size fields.

Yes, order is fixed up.

[STRINGS] For all JSON string literals in the schema text, replace any escaped characters (e.g., \uXXXX escapes) with their UTF-8 equivalents.

Not sure about this.

[INTEGERS] Eliminate quotes around and any leading zeros in front of JSON integer literals (which appear in the size attributes of fixed schemas).

This is probable.

[WHITESPACE] Eliminate all whitespace in JSON outside of string literals.

Yes, this.

@kbatuigas
Copy link
Contributor Author

We will close this PR and mark https://redpandadata.atlassian.net/browse/DOC-43 as Will Not Implement so we can explore what and how we want to document with regards to our normalization strategy. https://redpandadata.atlassian.net/browse/DOC-1296 has been opened to track this work.

@kbatuigas kbatuigas closed this Apr 30, 2025
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