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

求助,map[string]string动态添加属性,如何生成schema #349

Closed
snguovo opened this issue Feb 27, 2024 · 3 comments
Closed

求助,map[string]string动态添加属性,如何生成schema #349

snguovo opened this issue Feb 27, 2024 · 3 comments

Comments

@snguovo
Copy link

snguovo commented Feb 27, 2024

想提交一个类似http请求的表单,像headers这种map[string]string的object,key和value都是不定的,该如何生成schema呢?
我观察到官方json schema文档里有"additionalProperties": true是可以支持动态增加属性的。

@angellala
Copy link

同问+1,另外有场景根据用户选填 实时动态增加 json里的属性配置
image

@lljj-x
Copy link
Owner

lljj-x commented Mar 6, 2024

@snguovo 现在不支持 additionalProperties: true ,目前也不计划支持 。

可以用尝试数组来代替,比如 items: [{key, value}, {key, value}]

@lljj-x
Copy link
Owner

lljj-x commented Mar 6, 2024

@angellala 基于jsonschema的语法可以使用 anyOf

或者通过ui上的显示隐藏,可以使用 ui hidden表达式

@lljj-x lljj-x closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants