Skip to content

Commit

Permalink
fix: wrap embedded links in embedded groups (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
RutZap authored Oct 15, 2024
1 parent 64b0033 commit 0dc26d3
Show file tree
Hide file tree
Showing 5 changed files with 526 additions and 222 deletions.
21 changes: 14 additions & 7 deletions tools/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,23 @@ func (g *Generator) generateEmbeddedActionLinks() {
if input := g.Tools[toolId].getInput("$.where." + f.InverseFieldName.Value + ".id.equals"); input != nil {
displayOrder++
// embed the tool
tool.Config.EmbeddedActions = append(tool.Config.EmbeddedActions, &toolsproto.ActionLink{
ToolId: toolId,
Title: &toolsproto.StringTemplate{Template: f.Name}, // e.g. `orderItems` on a getOrder action
Data: []*toolsproto.DataMapping{
tool.Config.EmbedGroups = append(tool.Config.EmbedGroups, &toolsproto.EmbedGroup{
Title: &toolsproto.StringTemplate{Template: f.Name}, // e.g. `orderItems` on a getOrder action
DisplayOrder: int32(displayOrder),
Tools: []*toolsproto.EmbedGroup_EmbeddedActionLink{
{
Key: input.FieldLocation.Path,
Path: &toolsproto.JsonPath{Path: tool.getIDResponseFieldPath()},
ActionLink: &toolsproto.ActionLink{
ToolId: toolId,
Title: &toolsproto.StringTemplate{Template: f.Name}, // e.g. `orderItems` on a getOrder action
Data: []*toolsproto.DataMapping{
{
Key: input.FieldLocation.Path,
Path: &toolsproto.JsonPath{Path: tool.getIDResponseFieldPath()},
},
},
},
},
},
DisplayOrder: int32(displayOrder),
})

break
Expand Down
Loading

0 comments on commit 0dc26d3

Please sign in to comment.