Yq: Incorrect parsing of file with nested key

Created on 16 Feb 2017  路  5Comments  路  Source: mikefarah/yq

Given the following example:

version: '2'
services:
  test:
    image: ubuntu:14.04
    stdin_open: true
    tty: true

When I try to update the image key, using both the in place and write to stdout command:

yaml w docker-compose.yml services.test.image nginx:master
yaml w -i docker-compose.yml services.test.image nginx:master

I get unexpected output:

services:
  test:
    image: nginx:master
    stdin_open: true
    tty: true
version: "2"

Most helpful comment

The version key is getting reordered and double quoted. Obviously not a big deal since it still works, just something I noticed.

All 5 comments

Hi,
I'm not sure what the bug is it looks right to me :S
What am I missing?

The version key is getting reordered and double quoted. Obviously not a big deal since it still works, just something I noticed.

I also think we should provide a flag to keep the original order.

ah I see, nicely picked up. I'm going to raise to separate issues, one for the quoting and one for the ordering.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewsav-bt picture andrewsav-bt  路  6Comments

rgm3 picture rgm3  路  7Comments

tadayosi picture tadayosi  路  6Comments

tamalsaha picture tamalsaha  路  5Comments

jodh-intel picture jodh-intel  路  3Comments