在JSON模式中定义另一个选项时,需要使用可选选项

ade*_*ura 5 json jsonschema

我想定义certificate并privateKey在需要时secure标志设置为true.这有可能实现吗?

{
    type: 'object',
    properties: {
        'secure': {
            title: 'Serve files over HTTPS',
            description: 'Flag telling whether to serve contents over HTTPS and WSS',

            type: 'boolean',
            default: false
        },

        'certificate': {
            title: 'Certificate file',
            description: 'Location of the certificate file',

            type: 'string'
        },

        'privateKey': {
            title: 'Private key file',
            description: 'Location of the private key file',

            type: 'string'
        }
}
Run Code Online (Sandbox Code Playgroud)

Gre*_*ade 0

您是否要求架构内容依赖?我的意思是“架构允许的内容取决于目标(json)内容中的内容”?

你不能那样做。