Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(28664): Add schema management for the topic filters #682

Merged
merged 22 commits into from
Dec 10, 2024

Conversation

vanch3d
Copy link
Contributor

@vanch3d vanch3d commented Dec 9, 2024

See https://hivemq.kanbanize.com/ctrl_board/57/cards/28664/details/

This PR creates a new UX for managing the schema associated with topic filters. It refactors the secondary editor flow in the main list of topic filters (accessible through the "manage schema" CTA on every item).

The flow is based on three distinct operations:

  • the "current schema", if already present, is displayed using the generic rendering paradigm. It is possible to remove it.
  • a schema can be "uploaded" using a drag-and-drop interface or a file selector. The file is expected to be a JSON document, valid with JSON-Schema specification
  • a schema can be "inferred" from the traffic on the current Edge instance. If matching topics exist, all their schemas are displayed, for one of them to be selected for replacing the current schema

The three operations are rendered in tabs on a dedicated side panel.

Out-of-scope

  • JSON-Schema has a very relaxed validation process, to deal with a lot of cases. The properties are not even a mandatory part of the schema. The basic validation (RJSF + AJV) will only address structural errors (e.g. wrong JSON). Custom rules and restrictions on acceptable schemas should be considered.
  • the uploaded schema is expected to be a data-url bundle (https://www.rfc-editor.org/rfc/rfc2397) and is stored as such with its topic filter. This assumption might have to be reassessed
  • When uploading a schema, the file is directly updated on the relevant item in the list, by way of the PUT request. The GET cache is therefore updated and the React lifecycle automatically updates the DOM. The result is that the schema editor is closed abruptly. This behaviour might be considered too brusque for a proper UX and will be looked at in the subsequent ticket

Before

screenshot-localhost_3000-2024_12_09-15_11_00
screenshot-localhost_3000-2024_12_09-15_11_13

After

screenshot-localhost_3000-2024_12_09-15_09_36

screenshot-localhost_3000-2024_12_09-15_09_55

screenshot-localhost_3000-2024_12_09-15_10_03

screenshot-localhost_3000-2024_12_09-15_10_11

screenshot-localhost_3000-2024_12_09-15_10_30

@vanch3d vanch3d self-assigned this Dec 9, 2024
@cla-bot cla-bot bot added the cla-signed label Dec 9, 2024
@vanch3d vanch3d marked this pull request as ready for review December 9, 2024 15:44
@vanch3d vanch3d force-pushed the feat/28664/schema-topic-filter branch from c12f21c to 1007b0a Compare December 9, 2024 15:53
@vanch3d vanch3d force-pushed the feat/28664/schema-topic-filter branch from 772bfbf to 6700288 Compare December 10, 2024 16:37
@vanch3d vanch3d merged commit d840087 into master Dec 10, 2024
9 of 10 checks passed
@vanch3d vanch3d deleted the feat/28664/schema-topic-filter branch December 10, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants