Skip to content
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

User-defined type error for ARM template modules #11544

Closed
shenglol opened this issue Aug 16, 2023 · 0 comments · Fixed by #11546
Closed

User-defined type error for ARM template modules #11544

shenglol opened this issue Aug 16, 2023 · 0 comments · Fixed by #11546
Assignees
Labels
bug Something isn't working
Milestone

Comments

@shenglol
Copy link
Contributor

shenglol commented Aug 16, 2023

Bicep version
v0.20.4

Describe the bug
Got a type error when assigning a value to a deeply nested property of a parameter whose type is user defined. The error does not happen if the reference module that contains the user defined type is a Bicep file. However, it happens if the module reference is the compiled ARM template file. The bug was found in a public registry PR: Azure/bicep-registry-modules#440.

To Reproduce
Here's a minimal setup that reproduces the issue:

  • mod.bicep
type partitionKeyTypeForSqlContainerAndGremlinGraph = {
  kind: 'Hash' | 'MultiHash' | 'Range'?
}

type sqlContainerType = {
  partitionKey: partitionKeyTypeForSqlContainerAndGremlinGraph?
}

type sqlDatabaseType = {
  containers: sqlContainerType[]?
}

param sqlDatabases sqlDatabaseType[] = []
  • main.bicep
module mod 'mod.json' = {
  name: 'mod'
  params: {
    sqlDatabases: [
      {
        name: 'foo'
        containers: [
          {
            partitionKey: {
              kind: 'Hash' // The property "kind" expected a value of type "error | null" but the provided value is of type "'Hash'".
            }
          }
        ]
      }
    ]
  }
}

Additional context
Add any other context about the problem here.

@github-project-automation github-project-automation bot moved this to Todo in Bicep Aug 16, 2023
@jeskew jeskew added bug Something isn't working and removed Needs: Triage 🔍 labels Aug 16, 2023
@jeskew jeskew added this to the v0.21 milestone Aug 16, 2023
@jeskew jeskew moved this from Todo to In Progress in Bicep Aug 16, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Bicep Aug 17, 2023
jeskew added a commit that referenced this issue Aug 17, 2023
…t if encountered in the allowedValues constraint (#11546)

Resolves #11544
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/11546)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
2 participants