Skip to content

Commit

Permalink
Warn about upcoming API change
Browse files Browse the repository at this point in the history
  • Loading branch information
stilvoid committed Mar 11, 2019
1 parent a12d9d5 commit 4b1661a
Showing 1 changed file with 2 additions and 55 deletions.
57 changes: 2 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,59 +26,6 @@ Options:

### Go package documentation

```go
import "github.com/awslabs/aws-cloudformation-template-formatter/format"
```

Package format provides functions for formatting CloudFormation
templates using an opinionated, idiomatic format as used in AWS
documentation.

For each function, CloudFormation templates should be represented using
a `map[string]interface{}` as output by other libraries that parse
JSON/YAML such as `github.com/awslabs/goformation` and `encoding/json`.

Comments can be passed along with the template data in the following
format:

```go
map[interface{}]interface{}{
"": "This is a top-level comment",
"Resources": map[interface{}]interface{}{
"": "This is a comment on the whole `Resources` property",
"MyBucket": map[interface{}]interface{}{
"Properties": map[interface{}]interface{}{
"BucketName": "This is a comment on BucketName",
},
},
},
}
```

Empty string keys are taken to represent a comment on the overall node
that the comment is attached to. Numeric keys can be used to reference
elements of arrays in the source data.

#### Functions
**The API for cfn-format will be changing in 1.0.0**

```go
func Json(data map[string]interface{}) string
Json formats the CloudFormation template as a Json string
```

```go
func JsonWithComments(data map[string]interface{}, comments map[interface{}]interface{}) string
JsonWithComments formats the CloudFormation template as a Json string
with comments as provided
```

```go
func Yaml(data map[string]interface{}) string
Yaml formats the CloudFormation template as a Yaml string
```

```go
func YamlWithComments(data map[string]interface{}, comments map[interface{}]interface{}) string
YamlWithComments formats the CloudFormation template as a Yaml string
with comments as provided
```
To see the current Go documentation for cfn-format, please check <format/doc.go>.

0 comments on commit 4b1661a

Please sign in to comment.