Comments (3)
感觉上, object pattern properties在校验JSON数据上很有用,写一个pattern就能校验一大批字段。但是在表单场景,每个表单元素的schema都应该是明确的schema。因为schema不仅描述了数据校验,也同时描述了表单的UI,感觉非常难以想象一个确实必须使用pattern的表单渲染场景,能否给个现实场景? @Prodesire
from x-render.
感觉上, object pattern properties在校验JSON数据上很有用,写一个pattern就能校验一大批字段。但是在表单场景,每个表单元素的schema都应该是明确的schema。因为schema不仅描述了数据校验,也同时描述了表单的UI,感觉非常难以想象一个确实必须使用pattern的表单渲染场景,能否给个现实场景? @Prodesire
其实 patternProperties 非常常见。在我们内部使用场景中,用户要新建一个资源,他告诉服务端必要的信息(比如产品、类型),然后点一个按钮来动态生成资源。服务端会返回根据给定的信息找到相关的数据,动态生成出表示这个资源的数据结构(比如说这个资源有哪些属性,每个属性是什么类型,涉及到哪些增删改查API)。这份元数据就是要填写到表单中,由于元数据是动态生成的,深层次的数据结构中并不知道一个字典它有哪些key(就比如说我并不能事先知道资源的属性名称是什么,这些都是动态生成的,所以表单的校验规则中需要有 patternProperties进行正则匹配)。
@FateRiddle
from x-render.
schema本身也可以动态生成吧?Object Pattern Properties 太贴数据校验规范,而且写起来对于不熟悉JSON schema的用户来说也不友好。至于批量校验,会用别的方式来做。
from x-render.
Related Issues (20)
- collapse组件是否可以支持一个属性控制其默认展开或者折叠 HOT 1
- form-render-mobile 中 picker类的表单项设置disabled无效
- table如何自定义分页,或者如何修改他的属性和样式? HOT 3
- FormRender配置disabled: true后仍然校验该表单项 HOT 1
- beforeFinish无法在数组中的字段下提示校验失败
- 监听drawerList中字段值只会监听一次,同时如何实现drawerList中字段的联动 HOT 5
- Use latest color-picker component HOT 1
- fr-generator点击导入导出按钮弹出框没有生效 HOT 1
- form-render构建的表单,react组件销毁后,发现schema结构、表单元素、相关子节点等未主动销毁,占用内存未回收,长时间使用卡顿 HOT 4
- displayType 不是 column 的情况下出现 hideLabel 字符串 HOT 1
- form-render的Rules 校验中validateTrigger不生效 HOT 4
- time类型报invalideDate HOT 1
- form-render在rules中设置validateTrigger依然不生效
- drawerList edit 表单数值填充异常
- hideAdd为true, 复制按钮出现了。如果hideAdd为false,添加和复制按钮都没有了。 hideCopy不起任何作用。
- 使用 table-render的工具栏 toolbarAction 提示错误 不影响使用 但有顾虑
- TableRender 在使用搜索栏是否折叠的时候,当展开折叠,Select 组件里的 options 会丢失 HOT 1
- TableRender 的搜索监听
- Docs Typo: Correct misspelling 'defalut' to 'default
- 自定义组件的input或者别的表单,如何更合理的触发校验? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from x-render.