Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#### Improvements 🧹

- labels on scenario/step boards can be set with primary value (like layers) [#2579](https://github.com/terrastruct/d2/pull/2579)

#### Bugfixes ⛑️

- actors in sequence diagrams with labels and icons together no longer overlap, position keywords now work too [#2548](https://github.com/terrastruct/d2/pull/2548)
Expand Down
7 changes: 7 additions & 0 deletions d2compiler/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4210,9 +4210,16 @@ layers: {
RJ
}
}

scenarios: {
x: b {
k
}
}
`, "")
assert.Equal(t, "one", g.Layers[0].Root.Label.Value)
assert.Equal(t, "two", g.Layers[1].Root.Label.Value)
assert.Equal(t, "b", g.Scenarios[0].Root.Label.Value)
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion d2ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ func (c *compiler) resolveSubstitution(vars *Map, node Node, substitution *d2ast
}

func (c *compiler) overlay(base *Map, f *Field) {
if f.Map() == nil || f.Primary() != nil {
if f.Map() == nil {
c.errorf(f.References[0].Context_.Key, "invalid %s", NodeBoardKind(f))
return
}

base = base.CopyBase(f)
// Certain fields should never carry forward.
// If you give your scenario a label, you don't want all steps in a scenario to be labeled the same.
Expand Down
15 changes: 0 additions & 15 deletions d2ir/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,6 @@ steps: {
assertQuery(t, m, 0, 0, nil, "steps.nuclear.quiche")
},
},
{
name: "steps_panic",
run: func(t testing.TB) {
_, err := compile(t, `steps: {
shape: sql_table
id: int {constraint: primary_key}
}
scenarios: {
shape: sql_table
hey: int {constraint: primary_key}
}`)
assert.ErrorString(t, err, `TestCompile/steps/steps_panic.d2:3:3: invalid step
TestCompile/steps/steps_panic.d2:7:3: invalid scenario`)
},
},
{
name: "recursive",
run: func(t testing.TB) {
Expand Down
269 changes: 268 additions & 1 deletion testdata/d2compiler/TestCompile2/boards/board-label-primary.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading