[ZBX-23184] Suspision that YAML export is not compliant with standard Created: 2023 Aug 01  Updated: 2023 Aug 16  Resolved: 2023 Aug 16

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 6.0.20, 6.4.4, 7.0.0alpha3
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Jeroen Baten Assignee: Zabbix Development Team
Resolution: Won't fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix server 6.2.9 on Centos 8 stream


Sprint: Sprint 103 (Aug 2023)

 Description   

Steps to reproduce:

  1. select a single template
  2. Click Export button
  3. Select Yaml format

Result:
Exported yaml file beginning with:

zabbix_export:
  version: '6.2'
  date: '2023-08-01T13:08:21Z'
  template_groups:
    -
      uuid: 846977d1dfed4968bc5f8bdb363285bc
      name: 'Templates/Operating systems'

{{Also, using yamllint says: }}

1:1 warning  missing document start "---"  (document-start)

Also, there are a lot of errors because the lines are too long.

Expected:
I expect a Yaml file to begin with three dashes, "- - -"  (without the double quotes and without the spaces between the dashes as displayed here (Jira makes it a line otherwise) )

I looked into this and found the Yaml standard.

Turns out, version prior to 1.2 use "- - - " was used to sepearate documents so it makes sense not to start with three dashes when exporting a single template.

See https://yaml.org/spec/1.0/ and search for three dashes and you will find it in section 2.2.

Starting from Yaml standard version 1.2.0 that seems to have changed.

2.2. Structures

YAML uses three dashes (“---”) to separate directives from document content. This also serves to signal the start of a document if no directives are present.

I just thought I bring this to your attention. I hope you find this helpful.

Regards,

Jeroen Baten

 



 Comments   
Comment by dimir [ 2023 Aug 11 ]

The official documentation mentions "three dashes":

https://yaml.org/spec/1.2.2/

FYI this is one of the good candidates for YAML reference:

https://camel.readthedocs.io/en/latest/yamlref.html

Probably we should decide on the YAML version we support and document it.

Comment by Alexander Vladishev [ 2023 Aug 11 ]

The second document clearly states that these attributes are optional:

A document begins with — and ends with .... Both are optional, though a ... can only be followed by directives or ---. You don’t see multiple documents very often, but it’s a very useful feature for sending intermittent chunks of data over a single network connection. With JSON you’d usually put each chunk on its own line and delimit with newlines; YAML has support built in.

Comment by dimir [ 2023 Aug 11 ]

Agree. There is also

Documents may be preceded by directives, in which case the --- is required to indicate the end of the directives.

Do we ever use directives?

Comment by Alexander Vladishev [ 2023 Aug 11 ]

Our YAML files do not contain directives. Therefore, in our case, the triple-dash is optional.

I suggest to close this issue as WON'T FIX.

Generated at Wed Jun 18 08:14:59 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.