question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Titles in refs are not incorporated when constructing allOf/oneOf/anyOf dropdowns

See original GitHub issue

Prerequisites

Description

If a title property is stored within a $ref on an allOf, oneOf, or anyOf schema, it is not used when constructing a dropdown select for that schema.

Steps to Reproduce

You can see this in action here: https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0eXBlIjoib2JqZWN0Iiwib25lT2YiOlt7IiRyZWYiOiIjL2NvbXBvbmVudHMvc2NoZW1hcy9DYXQifSx7InRpdGxlIjoiV29vZiIsIiRyZWYiOiIjL2NvbXBvbmVudHMvc2NoZW1hcy9Eb2cifV0sImNvbXBvbmVudHMiOnsic2NoZW1hcyI6eyJQZXQiOnsidHlwZSI6Im9iamVjdCIsInJlcXVpcmVkIjpbInBldF90eXBlIl0sInByb3BlcnRpZXMiOnsicGV0X3R5cGUiOnsidHlwZSI6InN0cmluZyJ9fSwiZGlzY3JpbWluYXRvciI6eyJwcm9wZXJ0eU5hbWUiOiJwZXRfdHlwZSJ9fSwiRG9nIjp7ImFsbE9mIjpbeyIkcmVmIjoiIy9jb21wb25lbnRzL3NjaGVtYXMvUGV0In0seyJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJiYXJrIjp7InR5cGUiOiJib29sZWFuIn0sImJyZWVkIjp7InR5cGUiOiJzdHJpbmciLCJlbnVtIjpbIkRpbmdvIiwiSHVza3kiLCJSZXRyaWV2ZXIiLCJTaGVwaGVyZCJdfX19XX0sIkNhdCI6eyJ0aXRsZSI6Ik1lb3ciLCJ0eXBlIjoib2JqZWN0IiwiYWxsT2YiOlt7IiRyZWYiOiIjL2NvbXBvbmVudHMvc2NoZW1hcy9QZXQifSx7InR5cGUiOiJvYmplY3QiLCJwcm9wZXJ0aWVzIjp7Imh1bnRzIjp7InR5cGUiOiJib29sZWFuIn0sImFnZSI6eyJ0eXBlIjoiaW50ZWdlciJ9fX1dfX19fSwidWlTY2hlbWEiOnt9LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsidmFsaWRhdGUiOmZhbHNlLCJkaXNhYmxlIjpmYWxzZSwib21pdEV4dHJhRGF0YSI6ZmFsc2UsImxpdmVPbWl0IjpmYWxzZX19

We have a oneOf with both entries in the array being loaded via a $ref. One of them has a title alongside the $ref in the array, while the other has a title in the $ref schema. The one with the title alongside has its title represented in the dropdown, while the other has an option label of “Option 1”.

Expected behavior

Titles within a $ref should be incorporated into the dropdown option labels.

Actual behavior

Title is not accessed within the $ref when constructing the dropdown.

Version

Current HEAD

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
epicfaacecommented, Mar 10, 2021

@mr-bjerre I think you have to fix this line of code (https://github.com/rjsf-team/react-jsonschema-form/blob/master/packages/core/src/components/fields/MultiSchemaField.js#L135) so that it properly resolves $ref’s in the subschema before getting its title property.

0reactions
stale[bot]commented, Dec 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video: Create and manage drop-down lists - Microsoft Support
Training: Watch and learn how to insert a drop-down list in Excel to make data entry easier or to limit cell entries to...
Read more >
Video: Drop-down list settings - Microsoft Support
Training: You can use a comma-delimited list, a cell range, or a named range to define the options in a drop-down list. This...
Read more >
Create a drop-down list - Microsoft Support
To stop people from entering data that isn't in the drop-down list, click Stop . Note: If you don't add a title or...
Read more >
How to make a dependent (cascading) drop-down list in Excel
Go to the Data tab, click Data Validation and set up a drop-down list based on a named range in the usual way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found