add mandatory flags for values

This commit is contained in:
andreas 2023-10-09 19:01:05 +02:00
parent 7b6fa4b784
commit 4a93dd8fa4
2 changed files with 17 additions and 2 deletions

View File

@ -146,9 +146,11 @@ types:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
mandatory: true
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
mandatory: true
- key: bi
value: 2
label: "BiDir"
@ -157,9 +159,11 @@ types:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
mandatory: true
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
mandatory: true
- key: rx
value: 3
label: "RX"
@ -168,6 +172,7 @@ types:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
mandatory: true
- key: tx
value: 1
label: "TX"
@ -176,6 +181,7 @@ types:
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
mandatory: true
resources:
default: &esp32default
serial: 2

View File

@ -270,9 +270,12 @@ class PipelineInfo{
}
}
}
if (rt.target === undefined && typeof(parent) === 'object' && parent.target !== undefined){
if (rt.target === undefined && typeof(parent) === 'object'){
rt.target=parent.target;
}
if (rt.mandatory === undefined && typeof(parent) === 'object'){
rt.mandatory=parent.mandatory;
}
return rt;
}
const expandList=(lst,parent)=>{
@ -453,7 +456,13 @@ class PipelineInfo{
for (let k in configStruct) {
let struct = configStruct[k];
if (round > 0) config[k] = struct.key;
if (struct.target !== undefined && struct.value !== undefined) {
if (struct.target !== undefined ) {
if (struct.value === undefined){
if (struct.mandatory && round > 0){
errors+=" missing value for "+k+"\n";
}
continue;
}
if (struct.target === 'environment' ) {
if (round > 0) environment = struct.value;
else allowedResources=struct.resource;