Skip to content

Commit

Permalink
Fix Examples For Block Usage (#842)
Browse files Browse the repository at this point in the history
* fix examples for block usage

* more text fixes

* Update website/docs/plugin/framework/handling-data/blocks/list-nested.mdx

Co-authored-by: Benjamin Bennett <[email protected]>

* Apply suggestions from code review

Co-authored-by: Benjamin Bennett <[email protected]>

---------

Co-authored-by: Benjamin Bennett <[email protected]>
  • Loading branch information
tgoodsell-tempus and bendbennett authored Sep 15, 2023
1 parent b004395 commit 55392e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ In this example, a resource schema defines a top level list nested block named `
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Block{
"example_block": schema.ListNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand All @@ -69,7 +69,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand All @@ -84,7 +84,7 @@ In this example, a resource schema defines a top level list nested block named `
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Block{
"example_block": schema.ListNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand All @@ -100,7 +100,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ In this example, a resource schema defines a top level set nested block named `e
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Attribute{
"example_block": schema.SetNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand All @@ -69,7 +69,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand All @@ -84,7 +84,7 @@ In this example, a resource schema defines a top level set nested block named `e
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Block{
"example_block": schema.SetNestedBlock{
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand All @@ -100,7 +100,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ In this example, a resource schema defines a top level single nested block named
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Block{
"example_block": schema.SingleNestedBlock{
Attributes: map[string]schema.Attribute{
"attr1": schema.StringAttribute{
Expand All @@ -62,7 +62,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand All @@ -77,7 +77,7 @@ In this example, a resource schema defines a top level single nested block named
```go
func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Blocks: map[string]schema.Block{
"example_block": schema.SingleNestedBlock{
Attributes: map[string]schema.Attribute{
"attr": schema.ListAttribute{
Expand All @@ -91,7 +91,7 @@ func (r ThingResource) Schema(ctx context.Context, req resource.SchemaRequest, r
},
// ... potentially other fields ...
},
// ... potentially other attributes ...
// ... potentially other blocks ...
},
}
}
Expand Down

0 comments on commit 55392e2

Please sign in to comment.