fix: support {{ suffix }} name in 1.1 format version
This commit is contained in:
parent
697669bc47
commit
dfbcd84a00
7 changed files with 132 additions and 1 deletions
|
|
@ -448,7 +448,10 @@ class RougailOutputFormatter:
|
||||||
return y
|
return y
|
||||||
name = subpath.pop(0)
|
name = subpath.pop(0)
|
||||||
if name not in y and name.endswith('{{ identifier }}'):
|
if name not in y and name.endswith('{{ identifier }}'):
|
||||||
name = name[:-16]
|
search_name = name[:-16]
|
||||||
|
if search_name not in y:
|
||||||
|
search_name = name.replace("{{ identifier }}", "{{ suffix }}")
|
||||||
|
name = search_name
|
||||||
return _yaml(y[name])
|
return _yaml(y[name])
|
||||||
if self.main_namespace:
|
if self.main_namespace:
|
||||||
subpath = path.split('.')[1:]
|
subpath = path.split('.')[1:]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var1:
|
||||||
|
description: a first variable
|
||||||
|
default: value
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
disabled:
|
||||||
|
variable: _.var1
|
||||||
|
when: value
|
||||||
|
|
||||||
|
var3:
|
||||||
|
description: a third variable
|
||||||
|
default:
|
||||||
|
jinja: >-
|
||||||
|
{% if _.var1 == 'value' or _.var2 == 'blah' %}
|
||||||
|
value
|
||||||
|
{% endif %}
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var1:
|
||||||
|
description: a first variable
|
||||||
|
default: value
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
disabled:
|
||||||
|
variable: _.var1
|
||||||
|
when_not: value
|
||||||
|
|
||||||
|
var3:
|
||||||
|
description: a third variable
|
||||||
|
default:
|
||||||
|
jinja: >-
|
||||||
|
{% if _.var1 == 'value' or _.var2 == 'blah' %}
|
||||||
|
value
|
||||||
|
{% endif %}
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var1: value # a first variable
|
||||||
|
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
default:
|
||||||
|
variable: _.var1
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
var3:
|
||||||
|
description: a third variable
|
||||||
|
disabled:
|
||||||
|
variable: _.var2
|
||||||
|
when: value
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var1: value # a first variable
|
||||||
|
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
default:
|
||||||
|
variable: _.var1
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
var3:
|
||||||
|
description: a third variable
|
||||||
|
disabled:
|
||||||
|
variable: _.var2
|
||||||
|
when_not: value
|
||||||
|
...
|
||||||
22
tests/results/04_5validators_multi3/rougail/00-base.yml
Normal file
22
tests/results/04_5validators_multi3/rougail/00-base.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var1:
|
||||||
|
description: a second variable
|
||||||
|
test:
|
||||||
|
- 0
|
||||||
|
validators:
|
||||||
|
- jinja: |-
|
||||||
|
{% if _.var1 != index %}
|
||||||
|
value != than index
|
||||||
|
{% endif %}
|
||||||
|
description: value must be equal to index
|
||||||
|
params:
|
||||||
|
index:
|
||||||
|
type: index
|
||||||
|
default:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
var: # A identifier variable
|
||||||
|
- val1
|
||||||
|
- val2
|
||||||
|
|
||||||
|
'{{ identifier }}':
|
||||||
|
description: A dynamic family
|
||||||
|
dynamic:
|
||||||
|
variable: _.var
|
||||||
|
propertyerror: false
|
||||||
|
allow_none: true
|
||||||
|
|
||||||
|
'{{ identifier }}':
|
||||||
|
description: A dynamic family
|
||||||
|
dynamic:
|
||||||
|
variable: __.var
|
||||||
|
propertyerror: false
|
||||||
|
allow_none: true
|
||||||
|
|
||||||
|
var: # A dynamic variable
|
||||||
|
...
|
||||||
Loading…
Reference in a new issue