Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update templates to use jsonpaths #1597

Merged
merged 1 commit into from
Sep 11, 2024
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: 1 addition & 1 deletion tools/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func (g *Generator) makeTitle(action *proto.Action, model *proto.Model) *toolspr
fields := model.GetFields()
if len(fields) > 0 && fields[0].Type.Type == proto.Type_TYPE_STRING {
return &toolsproto.StringTemplate{
Template: "{{." + fields[0].GetName() + "}}",
Template: "{{$." + fields[0].GetName() + "}}",
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tools/proto/tools.pb.go

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

4 changes: 2 additions & 2 deletions tools/proto/tools.proto
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ message DefaultValue {
}

message StringTemplate {
// e.g. "{firstName} {lastName}" template syntax TBC.
// e.g. "{{$.firstName}} {{$.lastName}}" template syntax TBC.
string template = 1;

// If markdown is supported for this template. e.g.
// Italic text: _{{.Var}}_
// Italic text: _{{$.Var}}_
bool markdown = 2;
}

Expand Down
4 changes: 2 additions & 2 deletions tools/testdata/blog/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
}
],
"title": {
"template": "{{.name}}"
"template": "{{$.name}}"
},
"entitySingle": "category",
"entityPlural": "categories",
Expand Down Expand Up @@ -642,7 +642,7 @@
}
}
],
"title": { "template": "{{.title}}" },
"title": { "template": "{{$.title}}" },
"entitySingle": "blog post",
"entityPlural": "blog posts",
"capabilities": { "comments": true, "audit": true },
Expand Down
Loading