Are "on" and "off" that are supposed to be interpreted as true or false in YAML 1.2?

Yaml 1.1 says

Canonical:

at | P

Regexp:

at | Y | yes | yes | yes | n | N | no | no | NO | true | True | TRUE | false | False | FALSE | on | On | ON | off | Off | Off

Yaml 1.2 says

Definition:

Represents the value true / false. In languages ​​without a native Boolean type (for example, C), it is usually bound to a native integer type, using one for true and zero for false.

Canonical form:

Either trueor false.

Does this mean that all alternative forms in 1.1 should be interpreted in 1.2 as strings (rather than logical values) in deserialization?

+4
source share
2

, :

  • "on" "off", true false YAML 1.2?

    , on off (tag:yaml.org,2002:str).

  • , 1.1 1.2 ( ) ?

    , , .

    , YAML 1.2 10.2 JSON Schema. :

    JSON JSON. YAML , , . .

    , JSON true false boolean (tag:yaml.org,2002:bool).

    , YAML Core schema, JSON. - " JSON, ".

    true, true, true, false, false false .

+4

YAML 1.2 , , -, . "" , , , , .

ruamel.yaml PyYAML ( YAML 1.1 Yes/No/On/Off). , YAML YAML 1.1 ( , %YAML 1.1, . , - , , (.. , 1.2);-).

+2

Source: https://habr.com/ru/post/1669985/


All Articles