-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Refactor idSchema related code #950
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1027,9 +1027,15 @@ describe("utils", () => { | |
| }, | ||
| }; | ||
|
|
||
| expect(toIdSchema(schema)).eql({ | ||
| expect( | ||
| toIdSchema(schema, undefined, undefined, [ | ||
| { foo: "foo 0" }, | ||
| { foo: "foo 1" }, | ||
| ]) | ||
| ).eql({ | ||
| $id: "root", | ||
| foo: { $id: "root_foo" }, | ||
| 0: { $id: "root_0", foo: { $id: "root_0_foo" } }, | ||
| 1: { $id: "root_1", foo: { $id: "root_1_foo" } }, | ||
| }); | ||
| }); | ||
|
|
||
|
|
@@ -1068,13 +1074,11 @@ describe("utils", () => { | |
| $ref: "#/definitions/testdef", | ||
| }; | ||
|
|
||
| expect(toIdSchema(schema, undefined, schema.definitions, {}, "rjsf")).eql( | ||
| { | ||
| $id: "rjsf", | ||
| foo: { $id: "rjsf_foo" }, | ||
| bar: { $id: "rjsf_bar" }, | ||
| } | ||
| ); | ||
| expect(toIdSchema(schema, "rjsf", schema.definitions, {})).eql({ | ||
| $id: "rjsf", | ||
| foo: { $id: "rjsf_foo" }, | ||
| bar: { $id: "rjsf_bar" }, | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously Assuming we don't care about preserving the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code here in the master branch About passing downPreviously, About keeping idPrefixI didn't remove
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, now I'm even more confused. I definitely misread the code at first, and you're right, it seems like I'm the one who merged the PR to add
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am indeed using idPrefix to uniquely identify form elements from our tests. It could be good if you keep backwards compatibility, but I would understand if you don't.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @edi9999 Is there a reason you need |
||
| }); | ||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a preferred behavior for this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happen when the schema is a fix length array but the form data is longer then it. If those exceed are not go be displayed on the form then it should be fine not assigning an id.