Skip to content

Commit f91d70b

Browse files
committed
update
1 parent 6152451 commit f91d70b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

articles/azure-resource-manager/bicep/user-defined-data-types.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: User-defined types in Bicep
33
description: Describes how to define and use user-defined data types in Bicep.
44
ms.topic: conceptual
5-
ms.date: 01/04/2023
5+
ms.date: 01/09/2023
66
---
77

88
# User-defined data types in Bicep (Preview)
@@ -13,7 +13,7 @@ Bicep version 1.2 or newer is required. To install the latest versions, see [Ins
1313

1414
## Enable the preview feature
1515

16-
To enable this preview, modify your project's bicepconfig.json file to include the following JSON:
16+
To enable this preview, modify your project's [bicepconfig.json file](./bicep-config.md) to include the following JSON:
1717

1818
```json
1919
{
@@ -34,8 +34,13 @@ Valid type expression include:
3434
- Strings, integers, and booleans are valid data types to be used as type expressions.
3535

3636
```bicep
37-
type myStringLiteral = 'string'
37+
// a string type with three allowed values.
38+
type myStringLiteral = 'bicep' | 'arm' | 'azure'
39+
40+
// an integer type with one allowed value
3841
type myIntLiteral = 10
42+
43+
// an boolean type with one allowed value
3944
type myBoolLiteral = true
4045
```
4146
@@ -52,16 +57,17 @@ Valid type expression include:
5257
- Array types can be declared by suffixing `[]` to any valid type expression.
5358
5459
```bicep
60+
// A string type array
5561
type myStrStringsType1 = string[]
62+
// A string type array with three allowed values
5663
type myStrStringsType2 = ('a' | 'b' | 'c')[]
5764
5865
type myIntArrayOfArraysType = int[][]
5966
67+
// A mixed type array with four allowed values
6068
type myMixedTypeArrayType = ('fizz' | 42 | {an: 'object'} | null)[]
6169
```
6270
63-
Both **myStrStringsType1** and **myStrStringsType2** define a new array of strings. **myStrStringsType2** is defined with three allowed values.
64-
6571
- Object types contain zero or more properties between curly brackets:
6672
6773
```bicep
@@ -93,7 +99,7 @@ Valid type expression include:
9399
}
94100
```
95101
96-
But the following would not be:
102+
But the following would not be valid because none of `level1`, `level2`, `level3`, `level4`, or `level5` is optional, there is no JSON object that would be able to fulfill this schema.
97103
98104
```bicep
99105
type invalidRecursiveObject = {
@@ -109,8 +115,6 @@ Valid type expression include:
109115
}
110116
```
111117
112-
Because none of level1, level2, level3, level4, or level5 is optional, there is no JSON object that would be able to fulfill this schema.
113-
114118
- [Bicep unary operators](./operators.md) can be used with integer and boolean literals or references to integer or boolean literal-typed symbols:
115119
116120
```bicep
@@ -128,7 +132,7 @@ Valid type expression include:
128132
type mixedTypeArray = ('fizz' | 42 | {an: 'object'} | null)[]
129133
```
130134
131-
In addition to be used in the `type` statement, type expressions can also be used in these places:
135+
In addition to be used in the `type` statement, type expressions can also be used in these places for creating user-defined date types:
132136
133137
- As the type clause of a `param` statement. For example:
134138
@@ -144,12 +148,12 @@ In addition to be used in the `type` statement, type expressions can also be use
144148
```bicep
145149
param storageAccountConfig {
146150
name: string
147-
prperties: {
151+
properties: {
148152
sku: string
149153
}
150154
} = {
151155
name: 'store$(uniqueString(resourceGroup().id)))'
152-
prperties: {
156+
properties: {
153157
sku: 'Standard_LRS'
154158
}
155159
}
@@ -211,5 +215,4 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
211215

212216
## Next steps
213217

214-
* To learn about the available properties for user-defined functions, see [Understand the structure and syntax of ARM templates](./syntax.md).
215-
* For a list of the available template functions, see [ARM template functions](template-functions.md).
218+
- For a list of the Bicep date types, see [Data types](./data-types.md).

0 commit comments

Comments
 (0)