Skip to content

Commit 3112e9f

Browse files
committed
edit pass: six-bicep-articles
1 parent 0b75179 commit 3112e9f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: User-defined types in Bicep
3-
description: Describes how to define and use user-defined data types in Bicep.
3+
description: This article describes how to define and use user-defined data types in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
66
ms.date: 08/20/2024
@@ -14,14 +14,14 @@ Learn how to create user-defined data types in Bicep. For system-defined data ty
1414

1515
## Define types
1616

17-
You can use the `type` statement to create user-defined data types. In addition, you can also use type expressions in some places to define custom types.
17+
You can use the `type` statement to create user-defined data types. You can also use type expressions in some places to define custom types.
1818

1919
```bicep
2020
@<decorator>(<argument>)
2121
type <user-defined-data-type-name> = <type-expression>
2222
```
2323

24-
The [`@allowed`](./parameters.md#use-decorators) decorator is only permitted on [`param` statements](./parameters.md). To declare a type with a set of predefined values in a `type`, use [union type syntax](./data-types.md#union-types).
24+
The [`@allowed`](./parameters.md#use-decorators) decorator is permitted only on [`param` statements](./parameters.md). To declare a type with a set of predefined values in a `type`, use [union type syntax](./data-types.md#union-types).
2525

2626
The valid type expressions include:
2727

@@ -35,7 +35,7 @@ The valid type expressions include:
3535
type myOtherStringType = myStringType
3636
```
3737
38-
- Primitive literals, including strings, integers, and booleans, are valid type expressions. For example:
38+
- Primitive literals, including strings, integers, and Booleans, are valid type expressions. For example:
3939
4040
```bicep
4141
// a string type with three allowed values.
@@ -71,7 +71,7 @@ The valid type expressions include:
7171
}
7272
```
7373
74-
Each property in an object consists of a key and a value, separated by a colon `:`. The key can be any string, with nonidentifier values enclosed in quotes, and the value can be any type of expression.
74+
Each property in an object consists of a key and a value separated by a colon `:`. The key can be any string, with nonidentifier values enclosed in quotation marks. The value can be any type of expression.
7575
7676
Properties are required unless they have an optionality marker `?` after the property value. For example, the `sku` property in the following example is optional:
7777
@@ -82,7 +82,7 @@ The valid type expressions include:
8282
}
8383
```
8484
85-
Decorators can be used on properties. `*` can be used to make all values require a constraint. Additional properties can still be defined when using `*`. This example creates an object that requires a key of type `int` named *id*, and that all other entries in the object must be a string value at least 10 characters long.
85+
You can use decorators on properties. You can use an asterisk (`*`) to make all values require a constraint. You can define more properties by using `*`. This example creates an object that requires a key of type `int` named `id`. All other entries in the object must be a string value at least 10 characters long.
8686
8787
```bicep
8888
type obj = {
@@ -105,9 +105,9 @@ The valid type expressions include:
105105
}
106106
```
107107
108-
**Recursion**
108+
### Recursion
109109
110-
Object types can use direct or indirect recursion so long as at least leg of the path to the recursion point is optional. For example, the `myObjectType` definition in the following example is valid because the directly recursive `recursiveProp` property is optional:
110+
Object types can use direct or indirect recursion if at least the leg of the path to the recursion point is optional. For example, the `myObjectType` definition in the following example is valid because the directly recursive `recursiveProp` property is optional:
111111
112112
```bicep
113113
type myObjectType = {
@@ -116,7 +116,7 @@ The valid type expressions include:
116116
}
117117
```
118118
119-
But the following type definition wouldn't be valid because none of `level1`, `level2`, `level3`, `level4`, or `level5` is optional.
119+
The following type definition wouldn't be valid because none of `level1`, `level2`, `level3`, `level4`, or `level5` is optional.
120120
121121
```bicep
122122
type invalidRecursiveObjectType = {
@@ -132,7 +132,7 @@ The valid type expressions include:
132132
}
133133
```
134134
135-
- [Bicep unary operators](./operators.md) can be used with integer and boolean literals or references to integer or boolean literal-typed symbols:
135+
- You can use [Bicep unary operators](./operators.md) with integer and Boolean literals or references to integer or Boolean literal-typed symbols:
136136
137137
```bicep
138138
type negativeIntLiteral = -10
@@ -149,7 +149,7 @@ The valid type expressions include:
149149
type mixedTypeArray = ('fizz' | 42 | {an: 'object'} | null)[]
150150
```
151151
152-
In addition to be used in the `type` statement, type expressions can also be used in these places for creating user-defined data types:
152+
You can use type expressions in the `type` statement, and you can also use type expressions to create user-defined data types, as shown in the following places:
153153
154154
- As the type clause of a `param` statement. For example:
155155
@@ -204,7 +204,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-04-01' = {
204204
}
205205
```
206206

207-
By using user-defined data types, it can look like:
207+
With user-defined data types, it can look like:
208208

209209
```bicep
210210
param location string = resourceGroup().location
@@ -239,21 +239,21 @@ Decorators are written in the format `@expression` and are placed above the decl
239239
| [export](#export) | all | none | Indicates that the user-defined data type is available for import by another Bicep file. |
240240
| [maxLength](#length-constraints) | array, string | int | The maximum length for string and array data types. The value is inclusive. |
241241
| [maxValue](#integer-constraints) | int | int | The maximum value for the integer data types. This value is inclusive. |
242-
| [metadata](#metadata) | all | object | Custom properties to apply to the data types. Can include a description property that is equivalent to the description decorator. |
242+
| [metadata](#metadata) | all | object | Custom properties to apply to the data types. Can include a description property that's equivalent to the description decorator. |
243243
| [minLength](#length-constraints) | array, string | int | The minimum length for string and array data types. The value is inclusive. |
244244
| [minValue](#integer-constraints) | int | int | The minimum value for the integer data types. This value is inclusive. |
245-
| [sealed](#sealed) | object | none | Elevate [BCP089](./diagnostics/bcp089.md) from a warning to an error when a property name of a use-define data type is likely a typo. For more information, see [Elevate error level](#elevate-error-level).|
245+
| [sealed](#sealed) | object | none | Elevate [BCP089](./diagnostics/bcp089.md) from a warning to an error when a property name of a user-defined data type is likely a typo. For more information, see [Elevate error level](#elevate-error-level).|
246246
| [secure](#secure-types) | string, object | none | Marks the types as secure. The value for a secure type isn't saved to the deployment history and isn't logged. For more information, see [Secure strings and objects](data-types.md#secure-strings-and-objects). |
247247

248-
Decorators are in the [sys namespace](bicep-functions.md#namespaces-for-functions). If you need to differentiate a decorator from another item with the same name, preface the decorator with `sys`. For example, if your Bicep file includes a variable named `description`, you must add the sys namespace when using the **description** decorator.
248+
Decorators are in the [sys namespace](bicep-functions.md#namespaces-for-functions). If you need to differentiate a decorator from another item with the same name, preface the decorator with `sys`. For example, if your Bicep file includes a variable named `description`, you must add the `sys` namespace when you use the `description` decorator.
249249

250250
### Discriminator
251251

252252
See [Tagged union data type](#tagged-union-data-type).
253253

254254
### Description
255255

256-
Add a description to the user-defined data type. Decorators can be used on properties. For example:
256+
Add a description to the user-defined data type. You can use decorators on properties. For example:
257257

258258
```bicep
259259
@description('Define a new object type.')
@@ -267,7 +267,7 @@ type obj = {
267267
}
268268
```
269269

270-
Markdown-formatted text can be used for the description text.
270+
You can use Markdown-formatted text for the description text.
271271

272272
### Export
273273

@@ -287,7 +287,7 @@ type month int
287287

288288
You can specify minimum and maximum lengths for string and array types. You can set one or both constraints. For strings, the length indicates the number of characters. For arrays, the length indicates the number of items in the array.
289289

290-
The following example declares two type. One type is for a storage account name that must have 3-24 characters. The other type is an array that must have from 1-5 items.
290+
The following example declares two types. One type is for a storage account name that must have 3 to 24 characters. The other type is an array that must have from one to five items.
291291

292292
```bicep
293293
@minLength(3)
@@ -314,15 +314,15 @@ You might use this decorator to track information about the data type that doesn
314314
type settings object
315315
```
316316

317-
When you provide a `@metadata()` decorator with a property that conflicts with another decorator, that decorator always takes precedence over anything in the `@metadata()` decorator. So, the conflicting property within the `@metadata()` value is redundant and will be replaced. For more information, see [No conflicting metadata](./linter-rule-no-conflicting-metadata.md).
317+
When you provide a `@metadata()` decorator with a property that conflicts with another decorator, that decorator always takes precedence over anything in the `@metadata()` decorator. So, the conflicting property within the `@metadata()` value is redundant and is replaced. For more information, see [No conflicting metadata](./linter-rule-no-conflicting-metadata.md).
318318

319319
### Sealed
320320

321321
See [Elevate error level](#elevate-error-level).
322322

323323
### Secure types
324324

325-
You can mark string or object user-defined data type as secure. The value of a secure type isn't saved to the deployment history and isn't logged.
325+
You can mark a string or object user-defined data type as secure. The value of a secure type isn't saved to the deployment history and isn't logged.
326326

327327
```bicep
328328
@secure()
@@ -334,7 +334,7 @@ type demoSecretObject object
334334

335335
## Elevate error level
336336

337-
By default, declaring an object type in Bicep allows it to accept additional properties of any type. For example, the following Bicep is valid but raises a warning of [BCP089] - `The property "otionalProperty" is not allowed on objects of type "{ property: string, optionalProperty: null | string }". Did you mean "optionalProperty"?`:
337+
By default, declaring an object type in Bicep allows it to accept more properties of any type. For example, the following Bicep is valid but raises a warning of [BCP089]: `The property "otionalProperty" is not allowed on objects of type "{ property: string, optionalProperty: null | string }". Did you mean "optionalProperty"?`:
338338

339339
```bicep
340340
type anObject = {
@@ -348,7 +348,7 @@ param aParameter anObject = {
348348
}
349349
```
350350

351-
The warning informs you that the *anObject* type doesn't include a property named *otionalProperty*. While no errors occur during deployment, the Bicep compiler assumes *otionalProperty* is a typo, that you intended to use *optionalProperty* but misspelled it, and alert you to the inconsistency.
351+
The warning informs you that the `anObject` type doesn't include a property named `otionalProperty`. Although no errors occur during deployment, the Bicep compiler assumes that `otionalProperty` is a typo and that you intended to use `optionalProperty` but misspelled it. Bicep alerts you to the inconsistency.
352352

353353
To escalate these warnings to errors, apply the `@sealed()` decorator to the object type:
354354

@@ -375,7 +375,7 @@ param aParameter anObject = {
375375
}
376376
```
377377

378-
The ARM deployment engine also checks sealed types for additional properties. Providing any extra properties for sealed parameters results in a validation error, causing the deployment to fail. For example:
378+
The Azure Resource Manager deployment engine also checks sealed types for other properties. Providing any extra properties for sealed parameters results in a validation error, which causes the deployment to fail. For example:
379379

380380
```bicep
381381
@sealed()
@@ -414,6 +414,6 @@ output config object = serviceConfig
414414

415415
For more information, see [Custom tagged union data type](./data-types.md#custom-tagged-union-data-type).
416416

417-
## Next steps
417+
## Related content
418418

419-
- For a list of the Bicep data types, see [Data types](./data-types.md).
419+
For a list of the Bicep data types, see [Data types](./data-types.md).

0 commit comments

Comments
 (0)