Skip to content

Commit

Permalink
Parse the items property on config type declarations
Browse files Browse the repository at this point in the history
When parsing a template, parse the `items` property on configuration type declarations.

Fixes #606
  • Loading branch information
julienp committed Aug 21, 2024
1 parent 88532b6 commit 0872460
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
- [features] add "pulumi.organiztion" to the built-in "pulumi" variable to obtain the current organization.

### Bug Fixes

- Parse the items property on config type declarations to prevent diagnostic messages about
unknown fields [#615](https://github.com/pulumi/pulumi-yaml/pull/615)
11 changes: 11 additions & 0 deletions pkg/pulumiyaml/ast/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@ func (d *PropertyMapDecl) parse(name string, node syntax.Node) syntax.Diagnostic
return diags
}

type ConfigItemsDecl struct {
declNode

Type *StringExpr
}

func (d *ConfigItemsDecl) recordSyntax() *syntax.Node {
return &d.syntax
}

type ConfigParamDecl struct {
declNode

Expand All @@ -276,6 +286,7 @@ type ConfigParamDecl struct {
Secret *BooleanExpr
Default Expr
Value Expr
Items *ConfigItemsDecl
}

func (d *ConfigParamDecl) recordSyntax() *syntax.Node {
Expand Down
7 changes: 7 additions & 0 deletions pkg/pulumiyaml/ast/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import (
const example = `
name: simple-yaml
runtime: yaml
config:
some-string-array:
type: array
items:
type: string
some-boolean:
type: boolean
resources:
my-bucket:
type: aws:s3/bucket:Bucket
Expand Down

0 comments on commit 0872460

Please sign in to comment.