Add strict custom field registry
This commit is contained in:
@@ -33,6 +33,11 @@ func LoadProject(root string) (*Project, error) {
|
||||
project.LoadIssues = append(project.LoadIssues, Issue{Level: "error", Code: "manifest_error", File: "gsp.manifest", Message: err.Error()})
|
||||
}
|
||||
project.Manifest = manifest
|
||||
fields, err := loadFieldRegistry(absRoot, project.Manifest)
|
||||
if err != nil {
|
||||
project.LoadIssues = append(project.LoadIssues, Issue{Level: "error", Code: "field_registry_error", File: project.Manifest.fieldRegistryPath(), Message: err.Error()})
|
||||
}
|
||||
project.Fields = fields
|
||||
|
||||
var files []string
|
||||
for _, scanEntry := range project.Manifest.scanEntries() {
|
||||
@@ -98,6 +103,14 @@ func readUnit(root, file string) (*Unit, error) {
|
||||
if err := yaml.Unmarshal(data, &unit); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var raw map[string]any
|
||||
if err := yaml.Unmarshal(data, &raw); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
unit.RawFields = map[string]any{}
|
||||
for key, value := range raw {
|
||||
unit.RawFields[key] = normalizeRawYAML(value)
|
||||
}
|
||||
unit.File = relPath(root, file)
|
||||
return &unit, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user