Skip to content

feat(produce): schema-aware Produce Record UI (UX-1292)#2462

Open
c-julin wants to merge 3 commits into
jc/ux-1292-backendfrom
jc/ux-1292-frontend
Open

feat(produce): schema-aware Produce Record UI (UX-1292)#2462
c-julin wants to merge 3 commits into
jc/ux-1292-backendfrom
jc/ux-1292-frontend

Conversation

@c-julin
Copy link
Copy Markdown
Contributor

@c-julin c-julin commented May 21, 2026

Summary

Frontend half of the schema-aware Produce Record flow. Stacked on #2461 — review/merge the backend PR first; this branch's diff against master collapses to just the UI changes once that lands.

  • topic-produce.tsx — subject + version selection, encoding-aware schema picker, Protobuf message-type dropdown reading off the new messageTypes field on subject details, sample-JSON generation via GenerateSchemaSample.
  • backend-api / rest-interfaces — new SchemaMessageType type + messageTypes field on SchemaRegistryVersionedSchema; supporting REST bindings for the schemas / subject-types endpoints.
  • Clearing on encoding change: when the user switches encoding (Avro ↔ Protobuf ↔ JSON Schema), the schema name + version + Protobuf indexPath are cleared so the dropdown re-populates from the encoding-filtered subject list. Defaulting on subject/version pick: when a subject or version is selected, the first available message type is pre-selected. All driven via event handlers — no useEffect added.

Test plan

  • Produce against an Avro-typed subject — sample JSON renders, schema-registry serde validates on submit.
  • Produce against a Protobuf-typed subject with multiple messages — message-type dropdown shows all messages with indexPath, sample renders for the selected type.
  • Switch encoding Avro → Protobuf → JSON Schema mid-form — schema + version + message-type clear; dropdown re-filters.
  • Switch subject within the same encoding — version defaults to latestActive, message-type defaults to first available.
  • Switch version on the same subject — message-type defaults to first for that version.

c-julin added 3 commits May 21, 2026 19:22
Frontend half of the schema-aware Produce Record flow (stacked on the
backend PR).

- topic-produce: subject + version selection, encoding-aware schema
  picker, Protobuf message-type dropdown reading off the new
  messageTypes field on subject details, sample-JSON generation via
  GenerateSchemaSample.
- backend-api / rest-interfaces: new SchemaMessageType type +
  messageTypes field on SchemaRegistryVersionedSchema; supporting REST
  bindings for the schemas / subject-types endpoints.
A subject's compatible schema set is encoding-specific (Avro vs Protobuf
vs JSON Schema), so any pre-selected subject/version becomes stale the
moment the user changes encoding. Reset key/value schemaName,
schemaVersion, and protobufIndexPath on encoding change so the dropdown
re-populates from the encoding-filtered subject list.
Addresses adversarial code review findings on PR #2462:

- Stale refreshSchemaDetails-response guard on both schemaName onChange
  handlers: if the user switches subject while a fetch is in flight,
  drop the response instead of overwriting the new selection's version
  and message-type.
- Submit-time validation: block publish when the encoding requires a
  schema but schemaName/schemaVersion are missing or schemaId hasn't
  resolved yet. Without this the form silently submitted with
  encoding=PROTOBUF and no schema_id, producing a confusing backend error.
- Auto-detect on mount no longer clobbers user edits: a getValues()
  check bails out if the user has already changed encoding or picked a
  subject/version while the detection fetch was in flight.
- Auto-detect now calls applyDefaultMessageType for Protobuf subjects so
  the message-type picker isn't left blank after a successful detection.
- generateSchemaSample errors surface as toasts via
  formatToastErrorMessageGRPC instead of being silently swallowed.
@c-julin c-julin force-pushed the jc/ux-1292-frontend branch from 97ae5d7 to 034fabe Compare May 21, 2026 18:28
if (t === SchemaType.PROTOBUF) {
return PayloadEncoding.PROTOBUF;
}
if (t === SchemaType.AVRO) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I could try to add support for avro to use proto form hook or auto form component if that helps, then we could indeed use it here E2E, WDYT

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.

2 participants