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: pass down indexed title from array field #4002

Merged

Conversation

Rozamo
Copy link
Contributor

@Rozamo Rozamo commented Dec 10, 2023

Reasons for making this change

Fixes #3983

Changes

  • Pass down indexed title from ArrayField to children
  • Use the above title in SchemaField, BooleanField and ObjectField and ArrayField
  • Add tests for the above changes

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@Rozamo Rozamo marked this pull request as draft December 10, 2023 12:52
@Rozamo Rozamo marked this pull request as ready for review December 10, 2023 13:35
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

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

Can you please update the tests to validate these changes

CHANGELOG.md Outdated
@@ -15,6 +15,12 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
should change the heading of the (upcoming) version to include a major version bump.

-->
# 5.16.1
Copy link
Member

Choose a reason for hiding this comment

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

This is a point release

Suggested change
# 5.16.1
# 5.15.2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Rozamo
Copy link
Contributor Author

Rozamo commented Dec 13, 2023

Can you please update the tests to validate these changes

Added tests for ArrayField. Let me know if tests at other places are also required.

@nickgros
Copy link
Contributor

My only concern is that we're changing the displayed index from 0-based to 1-based. Should we consider that a breaking change?

@Rozamo
Copy link
Contributor Author

Rozamo commented Dec 14, 2023

My only concern is that we're changing the displayed index from 0-based to 1-based. Should we consider that a breaking change?

Very good point. Should I remove the name value from being used in the fieldTitle then? That way the if no title is provided in the array schema, the name with 0 based indexing would be used for the title as it was before. And if they provide the title they would get the 1 based indexed titles.

The only reason I used 1 based indexing for title was that I think they are mostly used for cosmetic purposes and it is more readable. If the dev is not providing the title it means that they might not require the readiblilty part.

@heath-freenome
Copy link
Member

My only concern is that we're changing the displayed index from 0-based to 1-based. Should we consider that a breaking change?

Very good point. Should I remove the name value from being used in the fieldTitle then? That way the if no title is provided in the array schema, the name with 0 based indexing would be used for the title as it was before. And if they provide the title they would get the 1 based indexed titles.

The only reason I used 1 based indexing for title was that I think they are mostly used for cosmetic purposes and it is more readable. If the dev is not providing the title it means that they might not require the readiblilty part.

Yes, having title be 1 based only is not a breaking change

@heath-freenome heath-freenome merged commit 39f6451 into rjsf-team:main Dec 14, 2023
4 checks passed
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.

Make array items take title from the parent if available
3 participants