Files
NageshbansalandGitHub b7722f0f22 feat: introduce casting kind (#116)
### Summary                            

- Introduce a `kind` discriminator for Casting. Existing Casting without
a kind field keep working, empty kind defaults to `Installation`
- New `api/v1alpha1/installation/` subpackage with the Installation
Casting, Spec types and holds its own JSON schema from its Go type:
`installation/casting.schema.json`
- New Machinery interface in `api/v1alpha1/machinery.go` exposes
`Kind()` and `TrackableProperties()` so Dispatcher(Getv1alpha1 and
Forge/Cast/Gauge) work across any kind without knowing its concrete
type.
- A root casting.schema.json lists every per-Kind schema to supports
IDEs completion from one schema URL
- cmd/foundryctl gen schemas reads a list of types from schemaTargets.
Adding a kind means adding one entry.
  
Related: https://github.com/SigNoz/platform-pod/issues/1970
2026-05-16 17:40:03 +05:30

27 lines
482 B
Go

package installation
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestSchema(t *testing.T) {
t.Parallel()
assert.NotNil(t, Schema())
}
func TestSchemaValidatesDefault(t *testing.T) {
t.Parallel()
contents, err := json.Marshal(Default())
require.NoError(t, err)
var payload map[string]any
require.NoError(t, json.Unmarshal(contents, &payload))
assert.NoError(t, Schema().Validate(payload))
}