Skip to content
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
6 changes: 3 additions & 3 deletions libs/dyn/convert/normalize.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ func nullWarning(expected dyn.Kind, src dyn.Value, path dyn.Path) diag.Diagnosti

func typeMismatch(expected dyn.Kind, src dyn.Value, path dyn.Path) diag.Diagnostic {
return diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: fmt.Sprintf("expected %s, found %s", expected, src.Kind()),
Location: src.Location(),
Path: path,
Expand DownExpand Up@@ -300,7 +300,7 @@ func (n normalizeOptions) normalizeInt(typ reflect.Type, src dyn.Value, path dyn
}

return dyn.InvalidValue, diags.Append(diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: fmt.Sprintf("cannot parse %q as an integer", src.MustString()),
Location: src.Location(),
Path: path,
Expand DownExpand Up@@ -333,7 +333,7 @@ func (n normalizeOptions) normalizeFloat(typ reflect.Type, src dyn.Value, path d
}

return dyn.InvalidValue, diags.Append(diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: fmt.Sprintf("cannot parse %q as a floating point number", src.MustString()),
Location: src.Location(),
Path: path,
Expand Down
26 changes: 13 additions & 13 deletions libs/dyn/convert/normalize_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@ func TestNormalizeStructElementDiagnostic(t *testing.T) {
vout, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected string, found map`,
Location: dyn.Location{},
Path: dyn.NewPath(dyn.Key("bar")),
Expand DownExpand Up@@ -100,7 +100,7 @@ func TestNormalizeStructError(t *testing.T) {
_, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected map, found string`,
Location: vin.Get("foo").Location(),
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -245,7 +245,7 @@ func TestNormalizeMapElementDiagnostic(t *testing.T) {
vout, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected string, found map`,
Location: dyn.Location{},
Path: dyn.NewPath(dyn.Key("bar")),
Expand All@@ -271,7 +271,7 @@ func TestNormalizeMapError(t *testing.T) {
_, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected map, found string`,
Location: vin.Location(),
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -335,7 +335,7 @@ func TestNormalizeSliceElementDiagnostic(t *testing.T) {
vout, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected string, found map`,
Location: dyn.Location{},
Path: dyn.NewPath(dyn.Index(2)),
Expand All@@ -359,7 +359,7 @@ func TestNormalizeSliceError(t *testing.T) {
_, err := Normalize(typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected sequence, found string`,
Location: vin.Location(),
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -451,7 +451,7 @@ func TestNormalizeStringError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected string, found map`,
Location: dyn.Location{},
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -514,7 +514,7 @@ func TestNormalizeBoolFromStringError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected bool, found string`,
Location: vin.Location(),
Path: dyn.EmptyPath,
Expand All@@ -527,7 +527,7 @@ func TestNormalizeBoolError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected bool, found map`,
Location: dyn.Location{},
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -577,7 +577,7 @@ func TestNormalizeIntFromStringError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `cannot parse "abc" as an integer`,
Location: vin.Location(),
Path: dyn.EmptyPath,
Expand All@@ -590,7 +590,7 @@ func TestNormalizeIntError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected int, found map`,
Location: dyn.Location{},
Path: dyn.EmptyPath,
Expand DownExpand Up@@ -640,7 +640,7 @@ func TestNormalizeFloatFromStringError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `cannot parse "abc" as a floating point number`,
Location: vin.Location(),
Path: dyn.EmptyPath,
Expand All@@ -653,7 +653,7 @@ func TestNormalizeFloatError(t *testing.T) {
_, err := Normalize(&typ, vin)
assert.Len(t, err, 1)
assert.Equal(t, diag.Diagnostic{
Severity: diag.Error,
Severity: diag.Warning,
Summary: `expected float, found map`,
Location: dyn.Location{},
Path: dyn.EmptyPath,
Expand Down