support of number value in yaml
This commit is contained in:
parent
854bc6a013
commit
1f3c59737a
31 changed files with 81 additions and 61 deletions
|
@ -29,7 +29,7 @@ En YAML :
|
||||||
```yml
|
```yml
|
||||||
param:
|
param:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
Créons la fonction correspondante :
|
Créons la fonction correspondante :
|
||||||
|
|
|
@ -77,7 +77,7 @@ En YAML :
|
||||||
- type: string
|
- type: string
|
||||||
text: val2
|
text: val2
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
- type: boolean
|
- type: boolean
|
||||||
text: true
|
text: true
|
||||||
- type: 'nil'
|
- type: 'nil'
|
||||||
|
@ -177,10 +177,10 @@ En YAML :
|
||||||
name: range
|
name: range
|
||||||
param:
|
param:
|
||||||
- type: number
|
- type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- type: number
|
- type: number
|
||||||
text: '10'
|
text: 10
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '9'
|
text: 9
|
||||||
```
|
```
|
||||||
|
|
|
@ -147,6 +147,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -287,6 +288,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -428,6 +430,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -569,6 +572,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -710,6 +714,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -909,6 +914,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1049,6 +1055,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1206,6 +1213,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1346,6 +1354,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1503,6 +1512,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1643,6 +1653,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
@ -1800,6 +1811,7 @@ mapping:
|
||||||
mapping:
|
mapping:
|
||||||
text:
|
text:
|
||||||
required: false
|
required: false
|
||||||
|
type: any
|
||||||
param:
|
param:
|
||||||
required: false
|
required: false
|
||||||
type: seq
|
type: seq
|
||||||
|
|
|
@ -19,6 +19,6 @@ constraints:
|
||||||
- name: calc_val
|
- name: calc_val
|
||||||
param:
|
param:
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
target:
|
target:
|
||||||
- text: mode_conteneur_actif
|
- text: mode_conteneur_actif
|
||||||
|
|
|
@ -19,9 +19,9 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: number
|
type: number
|
||||||
text: '100'
|
text: 100
|
||||||
target:
|
target:
|
||||||
- text: int
|
- text: int
|
||||||
|
|
|
@ -8,10 +8,10 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: number
|
type: number
|
||||||
text: '100'
|
text: 100
|
||||||
target:
|
target:
|
||||||
- optional: true
|
- optional: true
|
||||||
text: int
|
text: int
|
||||||
|
|
|
@ -14,7 +14,7 @@ variables:
|
||||||
type: number
|
type: number
|
||||||
description: No change
|
description: No change
|
||||||
value:
|
value:
|
||||||
- text: '100'
|
- text: 100
|
||||||
- variable:
|
- variable:
|
||||||
name: int
|
name: int
|
||||||
type: number
|
type: number
|
||||||
|
@ -25,7 +25,7 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: variable
|
type: variable
|
||||||
text: int2
|
text: int2
|
||||||
|
|
|
@ -21,14 +21,14 @@ variables:
|
||||||
help: bla bla bla
|
help: bla bla bla
|
||||||
choice:
|
choice:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- type: number
|
- type: number
|
||||||
text: '2'
|
text: 2
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- variable:
|
- variable:
|
||||||
name: test_variable
|
name: test_variable
|
||||||
type: number
|
type: number
|
||||||
|
@ -38,7 +38,7 @@ constraints:
|
||||||
- name: hidden_if_in
|
- name: hidden_if_in
|
||||||
source: enumvar
|
source: enumvar
|
||||||
param:
|
param:
|
||||||
- text: '4'
|
- text: 4
|
||||||
target:
|
target:
|
||||||
- type: variable
|
- type: variable
|
||||||
text: test_variable
|
text: test_variable
|
||||||
|
|
|
@ -21,11 +21,11 @@ variables:
|
||||||
help: bla bla bla
|
help: bla bla bla
|
||||||
choice:
|
choice:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- type: number
|
- type: number
|
||||||
text: '2'
|
text: 2
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
|
|
|
@ -21,11 +21,11 @@ variables:
|
||||||
help: bla bla bla
|
help: bla bla bla
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
choice:
|
choice:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- type: number
|
- type: number
|
||||||
text: '2'
|
text: 2
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
|
|
|
@ -9,12 +9,12 @@ variables:
|
||||||
description: New variable
|
description: New variable
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '9'
|
text: 9
|
||||||
choice:
|
choice:
|
||||||
- type: function
|
- type: function
|
||||||
name: trange
|
name: trange
|
||||||
param:
|
param:
|
||||||
- type: number
|
- type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- type: number
|
- type: number
|
||||||
text: '10'
|
text: 10
|
||||||
|
|
|
@ -15,7 +15,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
|
|
@ -15,7 +15,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
|
|
@ -15,7 +15,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
|
|
@ -8,14 +8,14 @@ variables:
|
||||||
type: number
|
type: number
|
||||||
description: "d\xE9lai en minutes avant lancement"
|
description: "d\xE9lai en minutes avant lancement"
|
||||||
value:
|
value:
|
||||||
- text: '0'
|
- text: 0
|
||||||
- variable:
|
- variable:
|
||||||
name: calc_url
|
name: calc_url
|
||||||
type: web_address
|
type: web_address
|
||||||
description: domain
|
description: domain
|
||||||
hidden: true
|
hidden: true
|
||||||
value:
|
value:
|
||||||
- text: '0'
|
- text: 0
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_val
|
- name: calc_val
|
||||||
|
|
|
@ -8,4 +8,4 @@ variables:
|
||||||
type: number
|
type: number
|
||||||
description: "d\xE9lai en minutes avant lancement"
|
description: "d\xE9lai en minutes avant lancement"
|
||||||
value:
|
value:
|
||||||
- text: '0'
|
- text: 0
|
||||||
|
|
|
@ -8,7 +8,7 @@ variables:
|
||||||
type: number
|
type: number
|
||||||
description: "d\xE9lai en minutes avant lancement"
|
description: "d\xE9lai en minutes avant lancement"
|
||||||
value:
|
value:
|
||||||
- text: '0'
|
- text: 0
|
||||||
- variable:
|
- variable:
|
||||||
name: day
|
name: day
|
||||||
type: number
|
type: number
|
||||||
|
|
|
@ -19,7 +19,7 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: variable
|
type: variable
|
||||||
text: int
|
text: int
|
||||||
|
|
|
@ -18,8 +18,8 @@ constraints:
|
||||||
- name: unknown
|
- name: unknown
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
text: '100'
|
text: 100
|
||||||
target:
|
target:
|
||||||
- text: int
|
- text: int
|
||||||
|
|
|
@ -18,6 +18,6 @@ constraints:
|
||||||
- name: valid_entier
|
- name: valid_entier
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
text: '100'
|
text: 100
|
||||||
|
|
|
@ -14,7 +14,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
|
|
@ -14,7 +14,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
@ -24,7 +24,7 @@ constraints:
|
||||||
name: condition_1
|
name: condition_1
|
||||||
propertyerror: true
|
propertyerror: true
|
||||||
- name: match
|
- name: match
|
||||||
text: '3128'
|
text: 3128
|
||||||
- name: mismatch
|
- name: mismatch
|
||||||
type: variable
|
type: variable
|
||||||
propertyerror: true
|
propertyerror: true
|
||||||
|
|
|
@ -11,7 +11,7 @@ variables:
|
||||||
description: "Port d'\xE9coute du proxy NTLM"
|
description: "Port d'\xE9coute du proxy NTLM"
|
||||||
mode: expert
|
mode: expert
|
||||||
value:
|
value:
|
||||||
- text: '3127'
|
- text: 3127
|
||||||
constraints:
|
constraints:
|
||||||
- fill:
|
- fill:
|
||||||
- name: calc_multi_condition
|
- name: calc_multi_condition
|
||||||
|
@ -21,7 +21,7 @@ constraints:
|
||||||
name: condition_2
|
name: condition_2
|
||||||
propertyerror: true
|
propertyerror: true
|
||||||
- name: match
|
- name: match
|
||||||
text: '3128'
|
text: 3128
|
||||||
- name: mismatch
|
- name: mismatch
|
||||||
type: variable
|
type: variable
|
||||||
propertyerror: true
|
propertyerror: true
|
||||||
|
|
|
@ -25,9 +25,9 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: number
|
type: number
|
||||||
text: '100'
|
text: 100
|
||||||
target:
|
target:
|
||||||
- text: vardynval1
|
- text: vardynval1
|
||||||
|
|
|
@ -8,4 +8,4 @@ variables:
|
||||||
type: number
|
type: number
|
||||||
description: "d\xE9lai en minutes avant lancement"
|
description: "d\xE9lai en minutes avant lancement"
|
||||||
value:
|
value:
|
||||||
- text: '0'
|
- text: 0
|
||||||
|
|
|
@ -21,14 +21,14 @@ variables:
|
||||||
help: bla bla bla
|
help: bla bla bla
|
||||||
choice:
|
choice:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- type: number
|
- type: number
|
||||||
text: '2'
|
text: 2
|
||||||
- type: number
|
- type: number
|
||||||
text: '3'
|
text: 3
|
||||||
value:
|
value:
|
||||||
- type: number
|
- type: number
|
||||||
text: '1'
|
text: 1
|
||||||
- variable:
|
- variable:
|
||||||
name: test_variable
|
name: test_variable
|
||||||
type: number
|
type: number
|
||||||
|
@ -38,7 +38,7 @@ constraints:
|
||||||
- name: hidden_if_in
|
- name: hidden_if_in
|
||||||
source: condition
|
source: condition
|
||||||
param:
|
param:
|
||||||
- text: '4'
|
- text: 4
|
||||||
target:
|
target:
|
||||||
- type: variable
|
- type: variable
|
||||||
text: test_variable
|
text: test_variable
|
||||||
|
|
|
@ -19,6 +19,6 @@ constraints:
|
||||||
param:
|
param:
|
||||||
- name: unknown
|
- name: unknown
|
||||||
type: number
|
type: number
|
||||||
text: '0'
|
text: 0
|
||||||
target:
|
target:
|
||||||
- text: int
|
- text: int
|
||||||
|
|
|
@ -18,9 +18,9 @@ constraints:
|
||||||
- name: valid_entier
|
- name: valid_entier
|
||||||
param:
|
param:
|
||||||
- name: mini
|
- name: mini
|
||||||
text: '0'
|
text: 0
|
||||||
- name: maxi
|
- name: maxi
|
||||||
type: number
|
type: number
|
||||||
text: '100'
|
text: 100
|
||||||
target:
|
target:
|
||||||
- text: int
|
- text: int
|
||||||
|
|
|
@ -23,8 +23,8 @@ variables:
|
||||||
text: a
|
text: a
|
||||||
choice:
|
choice:
|
||||||
- type: string
|
- type: string
|
||||||
text: '1'
|
text: 1
|
||||||
- type: string
|
- type: string
|
||||||
text: '2'
|
text: 2
|
||||||
- type: string
|
- type: string
|
||||||
text: '3'
|
text: 3
|
||||||
|
|
|
@ -115,6 +115,13 @@ def xml_to_yaml(filename, destfilename):
|
||||||
value = True
|
value = True
|
||||||
elif value == 'False':
|
elif value == 'False':
|
||||||
value = False
|
value = False
|
||||||
|
try:
|
||||||
|
# if it's a number
|
||||||
|
nvalue = int(value)
|
||||||
|
assert str(nvalue) == value
|
||||||
|
value = nvalue
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if key.startswith('@'):
|
if key.startswith('@'):
|
||||||
# remove @
|
# remove @
|
||||||
dico[key[1:]] = value
|
dico[key[1:]] = value
|
||||||
|
@ -127,7 +134,7 @@ def xml_to_yaml(filename, destfilename):
|
||||||
dico[key] = value
|
dico[key] = value
|
||||||
elif key == 'value':
|
elif key == 'value':
|
||||||
dico[key] = [{'text': value}]
|
dico[key] = [{'text': value}]
|
||||||
elif isinstance(value, (str, bool)):
|
elif isinstance(value, (str, bool, int)):
|
||||||
dico[key] = [{'text': value}]
|
dico[key] = [{'text': value}]
|
||||||
else:
|
else:
|
||||||
dico[key] = [value]
|
dico[key] = [value]
|
||||||
|
|
|
@ -19,7 +19,8 @@ def parse_dtd_subelement(obj_name, content, default_required=False):
|
||||||
yield {'name': content.name, 'type': None, 'required': default_required}
|
yield {'name': content.name, 'type': None, 'required': default_required}
|
||||||
if content.left:
|
if content.left:
|
||||||
if content.left.type == 'pcdata':
|
if content.left.type == 'pcdata':
|
||||||
yield {'name': 'text', 'type': None, 'required': False}
|
# choice
|
||||||
|
yield {'name': 'text', 'type': 'any', 'required': False}
|
||||||
else:
|
else:
|
||||||
yield {'name': content.left.name, 'type': None, 'required': default_required}
|
yield {'name': content.left.name, 'type': None, 'required': default_required}
|
||||||
if content.right:
|
if content.right:
|
||||||
|
|
Loading…
Reference in a new issue