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

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

Closed
3 tasks done
erunion opened this issue Aug 26, 2020 · 5 comments
Closed
3 tasks done

Comments

@erunion
Copy link
Collaborator

erunion commented Aug 26, 2020

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

@NixBiks
Copy link
Contributor

NixBiks commented Mar 10, 2021

Any pointers on how to fix this?

@epicfaace
Copy link
Member

epicfaace commented 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.

@NixBiks
Copy link
Contributor

NixBiks commented Mar 10, 2021

I'm probably going to need some help with those netlify failing jobs. Not sure why they would be affected

@epicfaace
Copy link
Member

I think that's a bug with Netlify (i.e. something with mismatches with Node version) -- you can just ignore those jobs.

@stale
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants