Azure / Azure/bicep

Improve the authoring experience for documenting nested properties

Open
#12,426 2 comments 0 reactions 0 assignees View on GitHub
discussion Needs: Upvote syntax
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

Multiline strings in Bicep do not allow the template author to specify which column should be considered the left-most margin. As a consequence, the `@description()` decorator expects that any indentation within a string is intentional and should be preserved.

If you're writing a description for a property on a type that's deeply nested, shunting everything over to the file's left margin can look odd:

```bicep
type myType = {
some: {
very: {
deeply: {
nested: {
@description('''A description
that
spans
multiple
lines.''')
property: string
}
}
}
}
}
```

It would be easier to follow the type's structure if Bicep multiline strings worked like C# raw string literals, e.g.:
```bicep
type myType = {
some: {
very: {
deeply: {
nested: {
@description('''A description
that
spans
multiple
lines.
''')
property: string
}
}
}
}
}
```

The description in the second example would today end with `\n `, so this would be a backwards incompatible change, though I'm not sure how disruptive it would be.

_Originally posted by @jeskew in https://github.com/Azure/bicep/issues/12412#issuecomment-1806381101_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Bicep parses multiline strings and how @description() consumes them. Compare the current trailing-indentation behavior with the C# raw string example and review the backwards-compatibility impact. Done means nested multiline descriptions can preserve relative indentation without unexpectedly retaining the closing delimiter's indentation.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.