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

fix(28833): Ensure JSONSchema examples are array #688

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

vanch3d
Copy link
Contributor

@vanch3d vanch3d commented Dec 10, 2024

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

There is a conflict in the definition of the examples keyword between the two versions of JSONSchema

  • v6 : examples?: JSONSchema6Type[] | undefined;
  • v7 : examples?: JSONSchema7Type | undefined;

The documentation for the validator used in the RJSF (AJV) states for v7 (https://ajv.js.org/json-schema.html#draft-07):

examples: an array of data instances. Ajv does not check the validity of these instances against the schema.

and validates the property as an array. This results in several schemas being rejected by the topic filter UX

screenshot-localhost_3000-2024_12_10-18_47_46

The PR ensures that every examples property handled by the frontend is created as an array of values

Out-of-scope

  • Externally created schemas might still be generated with a different version of JSONSchema. A "converter" will certainly be needed to handle such differences properly. It will be done in a future ticket

@vanch3d vanch3d self-assigned this Dec 10, 2024
@cla-bot cla-bot bot added the cla-signed label Dec 10, 2024
@vanch3d vanch3d marked this pull request as ready for review December 10, 2024 18:52
@vanch3d vanch3d force-pushed the fix/28833/json-schema-examples branch from e748c99 to 5a2567c Compare December 11, 2024 10:21
@vanch3d vanch3d merged commit 993c2aa into master Dec 11, 2024
9 of 10 checks passed
@vanch3d vanch3d deleted the fix/28833/json-schema-examples branch December 11, 2024 10:30
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