diff --git a/internal/core/blueprint.go b/internal/core/blueprint.go index 490611d6..bec1ec0b 100644 --- a/internal/core/blueprint.go +++ b/internal/core/blueprint.go @@ -15,12 +15,12 @@ type DaselValue = map[string]any var blueprintEngines = []string{"tree-sitter", "dasel", "command"} -// A Query is a single query that we want to run against a document. +// A Step is a single query that we want to run against a document. // // The result of the query is optionally assigned the given scope. -type Query struct { - Scope string `yaml:"scope"` - Operation string `yaml:"operation"` +type Step struct { + Scope string `yaml:"scope"` + Query string `yaml:"query"` } // A Blueprint is a set of queries that we want to run against a document. @@ -31,8 +31,8 @@ type Query struct { // - `dasel` // - `command` type Blueprint struct { - Engine string `yaml:"engine"` - Steps []Query `yaml:"steps"` + Engine string `yaml:"engine"` + Steps []Step `yaml:"steps"` } // A ScopedValues is a value that has been assigned a scope. @@ -77,7 +77,7 @@ func (b *Blueprint) Apply(f *File) ([]ScopedValues, error) { } for _, s := range b.Steps { - selected, verr := dasel.Select(value, s.Operation) + selected, verr := dasel.Select(value, s.Query) if verr != nil { return found, verr } diff --git a/internal/lint/code.go b/internal/lint/code.go index fa300bf8..065725aa 100755 --- a/internal/lint/code.go +++ b/internal/lint/code.go @@ -21,7 +21,7 @@ func updateQueries(f *core.File, blueprints map[string]*core.Blueprint) ([]strin } else if sec.Match(f.Path) { found := []string{} for _, query := range blueprint.Steps { - found = append(found, query.Operation) + found = append(found, query.Query) } return found, nil } diff --git a/testdata/styles/config/blueprints/OpenAPI.yml b/testdata/styles/config/blueprints/OpenAPI.yml index ad9555db..adc11460 100644 --- a/testdata/styles/config/blueprints/OpenAPI.yml +++ b/testdata/styles/config/blueprints/OpenAPI.yml @@ -1,6 +1,6 @@ engine: dasel steps: - scope: title - operation: info.title - - operation: info.description - - operation: servers.all().description + query: info.title + - query: info.description + - query: servers.all().description diff --git a/testdata/styles/config/blueprints/Python.yml b/testdata/styles/config/blueprints/Python.yml index a9eceb1c..b3a32a92 100644 --- a/testdata/styles/config/blueprints/Python.yml +++ b/testdata/styles/config/blueprints/Python.yml @@ -1,3 +1,3 @@ engine: tree-sitter steps: - - operation: (comment)+ @comment + - query: (comment)+ @comment diff --git a/testdata/styles/config/blueprints/Vale.yml b/testdata/styles/config/blueprints/Vale.yml index e5859790..6522e6e2 100644 --- a/testdata/styles/config/blueprints/Vale.yml +++ b/testdata/styles/config/blueprints/Vale.yml @@ -1,3 +1,3 @@ engine: dasel steps: - - operation: description + - query: description