I would like to define certificate
and privateKey
required when secure
flag is set to true. Is this possible to achieve?
{
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'
}
}
You can use 'dependencies' keyword.
{
dependencies: {
secure: ['certificate', 'privateKey']
}
}
You can even specify the schema the data should match when secure is present:
{
dependencies: {
secure: {
properties: {
certificate: {
type: 'string'
}
privateKey: {
type: 'string'
}
},
required: ['certificate', 'privateKey']
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With