[Identifier-naming] Migrate `core.ResolvedAlias` from v1beta1-generated to a v1beta2-generated Go package
enhancementframework/identifier-namingarea/schemas
## Context
The cluster-wide canonical-naming overhaul (tracked in [`docs/identifier-naming-migration.md` §21](docs/identifier-naming-migration.md)) declares completion across the repo cluster. One residual exception was surfaced during a follow-up audit of `meshery-extensions`: the `core.ResolvedAlias` Go type emits **snake_case** JSON tags on the wire, transitively contaminating every API endpoint that returns a design with `metadata.resolvedAliases`.
## The issue
Three schema versions reference `core.ResolvedAlias` via `x-go-type: map[string]core.ResolvedAlias`:
- `schemas/constructs/v1beta1/design/design.yaml:33`
- `schemas/constructs/v1beta2/design/design.yaml:35`
- `schemas/constructs/v1beta3/design/design.yaml:35`
But the **Go package** they all resolve to is `models/core/core.go`, which is generated from `schemas/constructs/v1beta1/core/api.yml` (snake_case wire form):
```go
// models/core/core.go
type NonResolvedAlias struct {
AliasComponentId Uuid `json:"alias_component_id"`
ImmediateParentId Uuid `json:"immediate_parent_id"`
ImmediateRefFieldPath []string `json:"immediate_ref_field_path"`
RelationshipId Uuid `json:"relationship_id"`
}
type ResolvedAlias struct {
NonResolvedAlias
ResolvedParentId Uuid `json:"resolved_parent_id"`
ResolvedRefFieldPath []string `json:"resolved_ref_field_path"`
}
```
Meanwhile `schemas/constructs/v1beta2/core/api.yml` already declares the canonical camelCase form:
```yaml
NonResolvedAlias:
properties:
relationshipId:
aliasComponentId:
immediateParentId:
immediateRefFieldPath:
ResolvedAlias:
allOf:
- $ref: "#/components/schemas/NonResolvedAlias"
- type: object
properties:
resolvedParentId:
resolvedRefFieldPath:
```
…but no `models/v1beta2/core/` Go package is generated. The v1beta2 schema is **aspirational only** — every consumer reads/writes the v1beta1-generated snake_case form.
## Cluster-wide impact
- `meshery/server/handlers/policy_relationship_handler.go` — uses `core.ResolvedAlias` from the snake-case package; emits snake-case JSON.
- `meshery-cloud/server/handlers/...` — same; cloud passes designs through transparently.
- `meshery-extensions/meshmap/src/components/ComponentConfigurator/index.tsx:379, 387` — reads `alias?.relationship_id`. Currently correct against the snake-case wire.
- `meshery-extensions/meshmap/src/domain/components.ts:102, 119, 144` — reads `alias.resolved_parent_id`. Currently correct against the snake-case wire.
- `meshery-extensions/meshmap/src/modules/editor/modes/operator/terminalStreaming.ts:85` — reads `getAlias(...)?.resolved_parent_id`. Same.
## Proposed approach
1. **Generate `models/v1beta2/core/` Go package** from `schemas/constructs/v1beta2/core/api.yml` (already canonical-camelCase). Either:
- Make `models/v1beta2/core/` a real generated directory in `build/generate-golang.js`, OR
- Promote `core.ResolvedAlias` to a v1beta3 cut alongside the design v1beta3 cut already merged in #873.
2. **Flip `x-go-type` references** in `schemas/constructs/v1beta2/design/design.yaml` and `schemas/constructs/v1beta3/design/design.yaml` to point at the new canonical package (`models/v1beta2/core/core.go` or `models/v1beta3/core/core.go`).
3. **Update consumers** in lockstep:
- `meshery/server/handlers/policy_relationship_handler.go`
- `meshery-cloud/server/...` (any direct use of `core.ResolvedAlias`)
- `meshery-extensions/meshmap/...` — flip 6 read sites to canonical (`relationshipId`, `resolvedParentId`, `aliasComponentId`, `immediateParentId`, `immediateRefFieldPath`, `resolvedRefFieldPath`).
4. **Consumer-audit gate**: add a check that flags any new `x-go-type: ...core...` reference pointing at `models/core/` rather than the versioned package.
## Out of scope
- The deprecated `models/core/core.go` package itself stays (per [§10 Agent 4.A](docs/identifier-naming-migration.md#10) — deprecated v1beta1 directories retained indefinitely under `info.x-deprecated: true`).
- Other shared-core types in `models/core/` (e.g., `Uuid`, `Time`, `Visibility`) — those are stable shapes (single-field type aliases) and don't need re-generation.
## Reference
- `meshery-extensions#4221` (Phase 5 consumer audit) — the audit that surfaced this gap and verified the runtime is currently correct against the snake_case wire.
- This issue is row 4 of the "Cluster-wide canonical-casing follow-ups still open" table in §21.A.
关闭于 2026-05-10 0 条评论