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

The data schema generated is not in json format #307

Open
kenzhang-mark43 opened this issue Apr 14, 2022 · 1 comment
Open

The data schema generated is not in json format #307

kenzhang-mark43 opened this issue Apr 14, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@kenzhang-mark43
Copy link

kenzhang-mark43 commented Apr 14, 2022

Tried the form builder here https://ginkgobioworks.github.io/react-json-schema-form-builder/
I can see the data schema is not in json format... so it is harder to test generated schema in the rjsf playground: https://rjsf-team.github.io/react-jsonschema-form/

should be quoted like

{
  "type": "object" ,
  "title": "hello"
}

This is what I get.

{
  type: 'object',
  title: 'hello',
  description: 'ta',
  properties: {
    newInput1: {
      enum: [
        '1',
        '2',
        '3'
      ],
      title: 'New Input 1',
      type: 'string',
      enumNames: [
        'Yes',
        'No',
        'Other'
      ]
    }
  },
  dependencies: {
    newInput1: {
      oneOf: [
        {
          properties: {
            newInput1: {
              enum: [
                '3'
              ]
            },
            Hello: {
              title: 'Hello,friend',
              type: 'string'
            }
          },
          required: []
        }
      ]
    }
  },
  required: []
}
@raymond-lam raymond-lam added bug Something isn't working good first issue Good for newcomers labels Apr 15, 2022
@nateplusplus
Copy link
Contributor

@raymond-lam I looked into this as a first issue to contribute but it looks to me like this is actually an issue with the package being used for JSON editors on the example pages. I'm getting the correct output from FormBuilder itself, showing double-quotes for all outputted JSON schemas.

When passing double-quoted JSON into react-json-editor-ajrm, that library will convert the quotes to single quotes every time.

Unfortunately, that package has been deprecated, however I have left a comment for the maintainer of that project to consider changing this in their next iteration.

I did some hunting to find a good alternative for this package but I honestly can't find one that does what react-json-editor-ajrm can do. Others use more of a form-style interface for editing JSON which is not ideal for this scenario.

Alternatively, we could simply display the JSON output on the example rather than allow it to be editable, but I do think showing that the JSON can be manipulated to change the form is a valuable demonstration. In my opinion, it might be best to wait until the new version of this JSON editor is released, as this issue is likely not a highly disruptive one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants