-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
commentBefore property has no effect #128
Comments
That usage pattern should work, but it clearly doesn't. What's happening here is that As is, here's how you could do what you're trying to do with the current API, with fewer layers of conversion taking place internally: const doc = YAML.parseDocument(input)
const secrets = doc.getIn(['task_definition', 'services', 'some_service', 'secrets'])
secrets.commentBefore = " Don't edit these secret bindings directly. They are generated."
secrets.set(0, { name: 'ANOTHER_NAME', value_from: 'ANOTHER_SOURCE' })
String(doc) version: 1
task_definition:
services:
some_service:
secrets:
# Don't edit these secret bindings directly. They are generated.
- name: ANOTHER_NAME
value_from: ANOTHER_SOURCE |
Actually I want to completely replace the const someService = doc.getIn(['task_definition','services','some_service']);
someService.set('secrets',secrets); Will that work? Anyways, the lack of special handling for YAML nodes already in the tree is precisely what I suspected. |
Actually if there is no special handling for YAML nodes, then why doesn't output look like this: version: 1
task_definition:
services:
some_service:
secrets:
items:
- key: name
value: ANOTHER_NAME
- key: value_from
value: ANOTHER_SOURCE
commentBefore: "Don't edit these secret bindings directly. They are generated." ? |
Yeah, that should work. There's also this API (these are documented here): doc.setIn(['task_definition','services','some_service','secrets'], secrets); The fix for your original issue looks like it'll be a one-liner. The reason why you're not seeing a |
Fixed in 1.7.2. |
test.js
:Actual output:
Expected output (more or less):
Additional information:
node --version: v12.11.1
The text was updated successfully, but these errors were encountered: