Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deserializing, editing, and serializing with preserving Anchors(&) and Aliases(*) #125

Open
norio-nomura opened this issue May 19, 2018 · 0 comments

Comments

@norio-nomura
Copy link
Collaborator

On current implementation, information about Anchors(&) and Aliases(*) are lost while compose().
e.g.:

import Foundation
import Yams

let node = try Yams.compose(yaml: """
aliases:
  - &steps-for-linux
    - checkout
    - run: swift test
version: 2
jobs:
  linux_swift_4.0.3:
    docker:
      - image: norionomura/swiftlint:swift-4.0.3
    steps: *steps-for-linux

  linux_swift_4.1.1:
    docker:
      - image: norionomura/swiftlint:swift-4.1.1
    steps: *steps-for-linux

""")

let string = try Yams.serialize(node: node!)
print(string)

output:

aliases:
- - checkout
  - run: swift test
version: 2
jobs:
  linux_swift_4.0.3:
    docker:
    - image: norionomura/swiftlint:swift-4.0.3
    steps:
    - checkout
    - run: swift test
  linux_swift_4.1.1:
    docker:
    - image: norionomura/swiftlint:swift-4.1.1
    steps:
    - checkout
    - run: swift test

To preserve Anchors and Aliases, it will need to introducing Node.alias(String).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant