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

json-schema minItems maxItems throws React warnings about minCount/maxCount #981

Closed
RainerAtSpirit opened this issue Jul 12, 2021 · 3 comments · Fixed by #1061
Closed

json-schema minItems maxItems throws React warnings about minCount/maxCount #981

RainerAtSpirit opened this issue Jul 12, 2021 · 3 comments · Fixed by #1061
Assignees
Labels
Help Wanted Orphaned and discontinued issues that need your help Type: Bug Bug reports and their fixes
Milestone

Comments

@RainerAtSpirit
Copy link

Using a schema like

const schema = {
  $schema: "http://json-schema.org/draft-07/schema#",
  $ref: "#/definitions/ApprovalRequest",
  definitions: {
    ApprovalRequest: {
      type: "object",
      properties: {
        approvers: {
          type: "array",
          minItems: 1,
          maxItems: 3,
          items: {
            type: "string"
          }
        }
      },
      required: ["approvers"]
    }
  }
};

throws in a react app.

Warning: React does not recognize the `minCount` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `mincount` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in div (created by List)
    in List (created by ListField)
    in ListField (created by AutoField)
    in AutoField (created by AutoValidatedQuickSemanticForm)
    in form (created by AutoValidatedQuickSemanticForm)
    in AutoValidatedQuickSemanticForm (created by App)
    in App

Link to reproduction app: https://codesandbox.io/s/dazzling-field-2lz6h?file=/App.tsx

@wadamek65
Copy link
Contributor

Hi @RainerAtSpirit , thanks for the issue report.

Certainly, in this case, it does not really make sense for minCount and maxCount to be added to a div element. Thanks for reproduction, this is clearly something that should be adjusted.

@wadamek65 wadamek65 added Type: Bug Bug reports and their fixes Help Wanted Orphaned and discontinued issues that need your help labels Jul 13, 2021
@radekmie
Copy link
Contributor

Adding a register.ts file with appropriate filterDOMProps.register call will be enough, just like in Simple Schema packages (example). @RainerAtSpirit: you can add it in your project as a workaround.

@radekmie radekmie added this to the v3.5 milestone Jul 14, 2021
@RainerAtSpirit
Copy link
Author

@radekmie: Thanks for the suggestion that did it.
I've updated the example accordingly: https://codesandbox.io/s/loving-tharp-mei4n?file=/schema/json-schema.tsx:182-196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Orphaned and discontinued issues that need your help Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants