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 - <<: *gpiopin
key: RX key: RX
target: "define:GWSERIAL_RX" target: "define:GWSERIAL_RX"
mandatory: true
- <<: *gpiopin - <<: *gpiopin
key: TX key: TX
target: "define:GWSERIAL_TX" target: "define:GWSERIAL_TX"
mandatory: true
- key: bi - key: bi
value: 2 value: 2
label: "BiDir" label: "BiDir"
@ -157,9 +159,11 @@ types:
- <<: *gpiopin - <<: *gpiopin
key: RX key: RX
target: "define:GWSERIAL_RX" target: "define:GWSERIAL_RX"
mandatory: true
- <<: *gpiopin - <<: *gpiopin
key: TX key: TX
target: "define:GWSERIAL_TX" target: "define:GWSERIAL_TX"
mandatory: true
- key: rx - key: rx
value: 3 value: 3
label: "RX" label: "RX"
@ -168,6 +172,7 @@ types:
- <<: *gpiopin - <<: *gpiopin
key: RX key: RX
target: "define:GWSERIAL_RX" target: "define:GWSERIAL_RX"
mandatory: true
- key: tx - key: tx
value: 1 value: 1
label: "TX" label: "TX"
@ -176,6 +181,7 @@ types:
- <<: *gpiopin - <<: *gpiopin
key: TX key: TX
target: "define:GWSERIAL_TX" target: "define:GWSERIAL_TX"
mandatory: true
resources: resources:
default: &esp32default default: &esp32default
serial: 2 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; rt.target=parent.target;
} }
if (rt.mandatory === undefined && typeof(parent) === 'object'){
rt.mandatory=parent.mandatory;
}
return rt; return rt;
} }
const expandList=(lst,parent)=>{ const expandList=(lst,parent)=>{
@ -453,7 +456,13 @@ class PipelineInfo{
for (let k in configStruct) { for (let k in configStruct) {
let struct = configStruct[k]; let struct = configStruct[k];
if (round > 0) config[k] = struct.key; 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 (struct.target === 'environment' ) {
if (round > 0) environment = struct.value; if (round > 0) environment = struct.value;
else allowedResources=struct.resource; else allowedResources=struct.resource;