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

Set default values for additionalProperties #3915

Closed
1 task done
jsj1027 opened this issue Oct 20, 2023 · 4 comments
Closed
1 task done

Set default values for additionalProperties #3915

jsj1027 opened this issue Oct 20, 2023 · 4 comments

Comments

@jsj1027
Copy link

jsj1027 commented Oct 20, 2023

Prerequisites

What theme are you using?

core

Is your feature request related to a problem? Please describe.

Unable to set the default values for the additionalProperties key-value combos.

Currently the key is always "newKey" and the value is "New Value".
It would be helpful if we could customize what the default key is in the jsonschema.
It would be also nice if you could just have the fields show up empty rather than with a value at all.

Describe the solution you'd like

Something like any of these in the jsonschema would be nice.

Allow both to have defaults
"additionalProperties": {
    "type": "string",
  "default_key": "Key",
  "default_value": "Value",
  }
 
 Allow just the value to have a default 
"additionalProperties": {
    "type": "string",
    "default": "Value",
  }
  
Allow it to just appear empty.
"additionalProperties": {
    "type": "string",
    "blank/empty": true, default of false
  }

Describe alternatives you've considered

Not really just what alternatives would be useful, maybe something you could set in the uiSchema?
Also if this is already possible please let me know, I think ive tried everything on the playground and couldn't figure it out.

@jsj1027 jsj1027 added feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned labels Oct 20, 2023
@jsj1027 jsj1027 changed the title <title> Set default values for additionalProperties Oct 20, 2023
@nickgros
Copy link
Contributor

@jsj1027 This would be a great feature and we would gladly review and accept a pull request to add it!

@nickgros nickgros added additionalProperties help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 20, 2023
@jsj1027
Copy link
Author

jsj1027 commented Oct 23, 2023

I'd love to add it personally, but I'm pretty Javascript rusty. So any guidance/direction on this would be appreciated.

@tomatommy-bs
Copy link
Contributor

I will just try to this problem 👍

@nickgros
Copy link
Contributor

nickgros commented Jul 8, 2024

Thanks @tomatommy-bs , this was added in v5.18.5

@nickgros nickgros closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants