Skip to content

cdk synth generates only json files when used with -o #2965

@ghidi

Description

@ghidi

We don’t have plans to output YAML to cdk.out

The cdk.out directory is a build artifact and generally intended to be read by machines and not by humans. As such we want to make sure it’s contents are deterministic and consistent and YAML is less stable then JSON (there are quirks related to yaml version, parsing, multi-line, etc).

Any yaml parser should be able to read json out of the box because YAML is designed as a superset of json (all json is valid yaml).

If you need to convert json to human readable yaml, there are many many tools you could use.

Original post

Describe the bug
cdk synth ignores -j option when used with -o. It will always produce json files even if -j is false or not present. As a result, it is not possible to synthesize yaml files in a given directory.

To Reproduce
cdk synth -o stacks
cdk synth -j false -o stacks

Expected behavior
There should be yaml files in the stacks dir.

Version:

  • OS MacOS
  • CDK Version 0.34.0

Metadata

Metadata

Assignees

Labels

@aws-cdk/coreRelated to core CDK functionalityeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions