feat: reimplement pathAlias for yaml fields
All checks were successful
Build and Push Server / build-and-push (push) Successful in 7m4s
All checks were successful
Build and Push Server / build-and-push (push) Successful in 7m4s
This commit is contained in:
@@ -18,11 +18,11 @@ type yamlBlock struct {
|
||||
}
|
||||
|
||||
type yamlField struct {
|
||||
Path string `yaml:"path"`
|
||||
Value any `yaml:"value,omitempty"`
|
||||
Codec string `yaml:"codec"`
|
||||
Hidden bool `yaml:"hidden,omitempty"`
|
||||
PathAlias string `yaml:"pathAlias,omitempty"`
|
||||
Path string `yaml:"path"`
|
||||
Value any `yaml:"value,omitempty"`
|
||||
Codec string `yaml:"codec"`
|
||||
Hidden bool `yaml:"hidden,omitempty"`
|
||||
PathAlias []string `yaml:"pathAlias,omitempty"`
|
||||
}
|
||||
|
||||
func parseYamlTemplate(input Slice) (block Block, err error) {
|
||||
@@ -53,6 +53,7 @@ func parseYamlTemplate(input Slice) (block Block, err error) {
|
||||
var fields []BlockField
|
||||
|
||||
for _, field := range blk.Fields {
|
||||
|
||||
if field.Path == "" {
|
||||
return block, fmt.Errorf("failed to parse field: %v", field)
|
||||
}
|
||||
@@ -66,18 +67,22 @@ func parseYamlTemplate(input Slice) (block Block, err error) {
|
||||
return block, fmt.Errorf("failed to parse codec -> %w", err)
|
||||
}
|
||||
|
||||
fields = append(fields, BlockField{
|
||||
Path: field.Path,
|
||||
CodecType: fieldCodec,
|
||||
Value: field.Value,
|
||||
Hidden: field.Hidden,
|
||||
})
|
||||
block := BlockField{
|
||||
Path: field.Path,
|
||||
PathAliases: field.PathAlias,
|
||||
CodecType: fieldCodec,
|
||||
Value: field.Value,
|
||||
Hidden: field.Hidden,
|
||||
}
|
||||
|
||||
fields = append(fields, block)
|
||||
|
||||
}
|
||||
|
||||
return Block{
|
||||
Type: DataBlock,
|
||||
Path: blk.Path,
|
||||
PathAliases: blk.PathAlias,
|
||||
Codec: codec,
|
||||
Fields: fields,
|
||||
ListTemplate: blk.ListTemplate,
|
||||
|
||||
Reference in New Issue
Block a user