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

Default values are not set for oneOf + ref in schema #3633

Closed
4 tasks done
anthonycaron opened this issue May 3, 2023 · 3 comments · Fixed by #3634
Closed
4 tasks done

Default values are not set for oneOf + ref in schema #3633

anthonycaron opened this issue May 3, 2023 · 3 comments · Fixed by #3634

Comments

@anthonycaron
Copy link
Contributor

Prerequisites

What theme are you using?

antd

Version

5.6.0

Current Behavior

I have a schema of a oneOf with two options referencing two different objects.

Here is an example:

{
  "definitions": {
    "foo": {
      "type": "object",
      "properties": {
        "fooProp": {
          "type": "string"
        },
        "fooProp2": {
          "type": "string",
          "default": "fooProp2"
        }
      }
    },
    "bar": {
      "type": "object",
      "properties": {
        "barProp": {
          "type": "string"
        },
        "barProp2": {
          "type": "string",
          "default": "barProp2"
        }
      }
    }
  },
  "oneOf": [
    {
      "$ref": "#/definitions/foo"
    },
    {
      "$ref": "#/definitions/bar"
    }
  ]
}

You can try it out here.

Expected Behavior

I would expect to have a default prop set for the properties that define one.

Steps To Reproduce

  1. Just go to the playground link provided in the description
  2. You will be able to see that in the formData we don't have the default value set

Environment

- OS: MacOs
- Node: 18.7.0
- npm: 8.15.0

Anything else?

No response

@anthonycaron anthonycaron added bug needs triage Initial label given, to be assigned correct labels and assigned labels May 3, 2023
@anthonycaron
Copy link
Contributor Author

I already have a fix for it but I can't find the way to open a PR. I tried to push my branch on this repo but it's been denied. I'm not sure what is the process, I couldn't find it in the docs either. Could you tell me how to proceed @heath-freenome please ?

@heath-freenome
Copy link
Member

@anthonycaron Fork the repo first. once you have a fork, push the branch to your fork then come to this page and you should be able to create the PR

@anthonycaron
Copy link
Contributor Author

Got it thanks !

@heath-freenome heath-freenome added help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants