Skip to content

[improve][pip] PIP-464: Deprecate legacy Jackson JsonSchema format for SchemaType.JSON#25361

Merged
codelipenghui merged 2 commits intoapache:masterfrom
codelipenghui:pip/pip-464
Mar 23, 2026
Merged

[improve][pip] PIP-464: Deprecate legacy Jackson JsonSchema format for SchemaType.JSON#25361
codelipenghui merged 2 commits intoapache:masterfrom
codelipenghui:pip/pip-464

Conversation

@codelipenghui
Copy link
Copy Markdown
Contributor

@codelipenghui codelipenghui commented Mar 19, 2026

Motivation

In Pulsar 2.1, SchemaType.JSON was standardized to use Apache Avro schema format for SchemaInfo.schema. However, the broker-side fallback logic (StructSchemaDataValidator and JsonSchemaCompatibilityCheck) is too lenient — it accepts any valid JSON as a schema definition, not just the legacy Jackson format from the 2.0 era.

This has caused real issues for non-Java clients (e.g., Rust) where users accidentally register JSON Schema Draft 2020-12 definitions. The broker accepts them, but Java consumers fail with SchemaParseException: Type not supported: object because AvroBaseStructSchema requires Avro format with no fallback.

Changes

This PIP proposes:

  • Add schemaJsonAllowLegacyJacksonFormat broker config (default false) to control whether the old Jackson JSON Schema format is accepted
  • When disabled (default), both StructSchemaDataValidator and JsonSchemaCompatibilityCheck strictly require valid Avro schema format, consistent with consumer-side requirements
  • When enabled, the current backward-compatible behavior is preserved
  • Deprecate (not remove) the ProducerImpl client-side code that sends old format to pre-v13 brokers

Impact

  • The legacy format has been superseded since Pulsar 2.1 (2018)
  • Java producers are unaffected (JSONSchema.of() has generated Avro format since 2.1)
  • Non-Java clients get a clear error at registration time instead of a confusing consumer-side failure
  • Users with genuine legacy schemas can opt in via the configuration flag

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

@codelipenghui Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@codelipenghui codelipenghui changed the title PIP-464: Strict Avro Schema Validation for SchemaType.JSON [improve][pip] PIP-464: Strict Avro Schema Validation for SchemaType.JSON Mar 19, 2026
@github-actions github-actions Bot added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. and removed doc-label-missing labels Mar 19, 2026
@codelipenghui codelipenghui changed the title [improve][pip] PIP-464: Strict Avro Schema Validation for SchemaType.JSON [improve][pip] PIP-464: Deprecate legacy Jackson JsonSchema format for SchemaType.JSON Mar 19, 2026
@codelipenghui codelipenghui self-assigned this Mar 19, 2026
Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@codelipenghui codelipenghui added this to the 4.2.0 milestone Mar 23, 2026
@codelipenghui codelipenghui merged commit 78281fd into apache:master Mar 23, 2026
20 checks passed
@codelipenghui codelipenghui deleted the pip/pip-464 branch March 23, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. PIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants