kindsys: Change "Meta" to "Properties" (#59852)

This commit is contained in:
sam boyer
2022-12-05 14:48:47 -05:00
committed by GitHub
parent 4e0f95dc31
commit 46143b0764
17 changed files with 237 additions and 158 deletions
+15 -6
View File
@@ -26,7 +26,7 @@ type Kind struct {
lin thema.ConvergentLineage[*Dashboard]
jcodec vmux.Codec
valmux vmux.ValueMux[*Dashboard]
decl kindsys.Decl[kindsys.CoreStructuredMeta]
decl kindsys.Decl[kindsys.CoreStructuredProperties]
}
// type guard
@@ -34,7 +34,7 @@ var _ kindsys.Structured = &Kind{}
// TODO standard generated docs
func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredMeta](rootrel, rt.Context(), nil)
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredProperties](rootrel, rt.Context(), nil)
if err != nil {
return nil, err
}
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(lin, k.decl.Meta.CurrentVersion)
cursch := thema.SchemaP(lin, k.decl.Properties.CurrentVersion)
tsch, err := thema.BindType[*Dashboard](cursch, &Dashboard{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
@@ -95,11 +95,20 @@ func (k *Kind) JSONValueMux(b []byte) (*Dashboard, thema.TranslationLacunas, err
// TODO standard generated docs
func (k *Kind) Maturity() kindsys.Maturity {
return k.decl.Meta.Maturity
return k.decl.Properties.Maturity
}
// TODO standard generated docs
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredMeta] {
// Decl returns the [kindsys.Decl] containing both CUE and Go representations of the
// dashboard declaration in .cue files.
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredProperties] {
d := k.decl
return &d
}
// Props returns a [kindsys.SomeKindProps], with underlying type [kindsys.CoreStructuredProperties],
// representing the static properties declared in the dashboard kind.
//
// This method is identical to calling Decl().Props. It is provided to satisfy [kindsys.Interface].
func (k *Kind) Props() kindsys.SomeKindProperties {
return k.decl.Properties
}
+15 -6
View File
@@ -26,7 +26,7 @@ type Kind struct {
lin thema.ConvergentLineage[*Playlist]
jcodec vmux.Codec
valmux vmux.ValueMux[*Playlist]
decl kindsys.Decl[kindsys.CoreStructuredMeta]
decl kindsys.Decl[kindsys.CoreStructuredProperties]
}
// type guard
@@ -34,7 +34,7 @@ var _ kindsys.Structured = &Kind{}
// TODO standard generated docs
func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredMeta](rootrel, rt.Context(), nil)
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredProperties](rootrel, rt.Context(), nil)
if err != nil {
return nil, err
}
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(lin, k.decl.Meta.CurrentVersion)
cursch := thema.SchemaP(lin, k.decl.Properties.CurrentVersion)
tsch, err := thema.BindType[*Playlist](cursch, &Playlist{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
@@ -95,11 +95,20 @@ func (k *Kind) JSONValueMux(b []byte) (*Playlist, thema.TranslationLacunas, erro
// TODO standard generated docs
func (k *Kind) Maturity() kindsys.Maturity {
return k.decl.Meta.Maturity
return k.decl.Properties.Maturity
}
// TODO standard generated docs
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredMeta] {
// Decl returns the [kindsys.Decl] containing both CUE and Go representations of the
// playlist declaration in .cue files.
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredProperties] {
d := k.decl
return &d
}
// Props returns a [kindsys.SomeKindProps], with underlying type [kindsys.CoreStructuredProperties],
// representing the static properties declared in the playlist kind.
//
// This method is identical to calling Decl().Props. It is provided to satisfy [kindsys.Interface].
func (k *Kind) Props() kindsys.SomeKindProperties {
return k.decl.Properties
}
+14 -5
View File
@@ -15,7 +15,7 @@ import (
// TODO standard generated docs
type Kind struct {
decl kindsys.Decl[kindsys.RawMeta]
decl kindsys.Decl[kindsys.RawProperties]
}
// type guard
@@ -23,7 +23,7 @@ var _ kindsys.Raw = &Kind{}
// TODO standard generated docs
func NewKind() (*Kind, error) {
decl, err := kindsys.LoadCoreKind[kindsys.RawMeta]("kinds/raw/svg", nil, nil)
decl, err := kindsys.LoadCoreKind[kindsys.RawProperties]("kinds/raw/svg", nil, nil)
if err != nil {
return nil, err
}
@@ -45,11 +45,20 @@ func (k *Kind) MachineName() string {
// TODO standard generated docs
func (k *Kind) Maturity() kindsys.Maturity {
return k.decl.Meta.Maturity
return k.decl.Properties.Maturity
}
// TODO standard generated docs
func (k *Kind) Decl() *kindsys.Decl[kindsys.RawMeta] {
// Decl returns the [kindsys.Decl] containing both CUE and Go representations of the
// svg declaration in .cue files.
func (k *Kind) Decl() *kindsys.Decl[kindsys.RawProperties] {
d := k.decl
return &d
}
// Props returns a [kindsys.SomeKindProps], with underlying type [kindsys.RawProperties],
// representing the static properties declared in the svg kind.
//
// This method is identical to calling Decl().Props. It is provided to satisfy [kindsys.Interface].
func (k *Kind) Props() kindsys.SomeKindProperties {
return k.decl.Properties
}
+15 -6
View File
@@ -26,7 +26,7 @@ type Kind struct {
lin thema.ConvergentLineage[*Team]
jcodec vmux.Codec
valmux vmux.ValueMux[*Team]
decl kindsys.Decl[kindsys.CoreStructuredMeta]
decl kindsys.Decl[kindsys.CoreStructuredProperties]
}
// type guard
@@ -34,7 +34,7 @@ var _ kindsys.Structured = &Kind{}
// TODO standard generated docs
func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredMeta](rootrel, rt.Context(), nil)
decl, err := kindsys.LoadCoreKind[kindsys.CoreStructuredProperties](rootrel, rt.Context(), nil)
if err != nil {
return nil, err
}
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(lin, k.decl.Meta.CurrentVersion)
cursch := thema.SchemaP(lin, k.decl.Properties.CurrentVersion)
tsch, err := thema.BindType[*Team](cursch, &Team{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
@@ -95,11 +95,20 @@ func (k *Kind) JSONValueMux(b []byte) (*Team, thema.TranslationLacunas, error) {
// TODO standard generated docs
func (k *Kind) Maturity() kindsys.Maturity {
return k.decl.Meta.Maturity
return k.decl.Properties.Maturity
}
// TODO standard generated docs
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredMeta] {
// Decl returns the [kindsys.Decl] containing both CUE and Go representations of the
// team declaration in .cue files.
func (k *Kind) Decl() *kindsys.Decl[kindsys.CoreStructuredProperties] {
d := k.decl
return &d
}
// Props returns a [kindsys.SomeKindProps], with underlying type [kindsys.CoreStructuredProperties],
// representing the static properties declared in the team kind.
//
// This method is identical to calling Decl().Props. It is provided to satisfy [kindsys.Interface].
func (k *Kind) Props() kindsys.SomeKindProperties {
return k.decl.Properties
}