Skip to content

Standardize schemas/models/core import to bare core alias#977

Merged
leecalcote merged 1 commit intomasterfrom
fix/standardize-core-import
Apr 9, 2026
Merged

Standardize schemas/models/core import to bare core alias#977
leecalcote merged 1 commit intomasterfrom
fix/standardize-core-import

Conversation

@leecalcote
Copy link
Copy Markdown
Member

Summary

Replaces non-standard import aliases (coreV1, corev1alpha1) for github.com/meshery/schemas/models/core with the bare core import across 4 files.

The project standard is core.Uuid, core.Map, etc. — no aliases.

Fixes #971

Files changed

  • files/error.gocoreV1core
  • files/identification.gocoreV1core
  • files/tests/sanitization_test.gocoreV1core
  • registry/component.gocorev1alpha1core

Test plan

  • go build ./... passes
  • go test ./... passes

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Copilot AI review requested due to automatic review settings April 9, 2026 18:50
@leecalcote leecalcote merged commit 0dd21c3 into master Apr 9, 2026
5 of 6 checks passed
@leecalcote leecalcote deleted the fix/standardize-core-import branch April 9, 2026 18:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Standardizes Go imports of github.com/meshery/schemas/models/core by removing non-standard aliases (coreV1, corev1alpha1) and using the canonical core.<Type> form across the touched MeshKit file handling and registry code, aligning with the project’s stated convention and addressing #971.

Changes:

  • Replace coreV1 import alias with bare core in file sanitization tests and file identification logic.
  • Replace corev1alpha1 import alias with bare core in registry component styling updates.
  • Update affected type references (IaCFileTypes, MesheryDesign, K8sManifest, HelmChart, DockerCompose, K8sKustomize, Shape) to use core.*.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
registry/component.go Removes corev1alpha1 alias and updates style Shape cast to core.Shape.
files/tests/sanitization_test.go Removes coreV1 alias and updates expected IaC file type constants to core.*.
files/identification.go Removes coreV1 alias and updates identified file type + trace map to core.*.
files/error.go Removes coreV1 alias and updates error helper signature to map[core.IaCFileTypes]error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the codebase by removing package aliases for the core schemas and updating type references accordingly. A review comment identifies a redundant assignment within a loop in registry/component.go that should be moved for efficiency, along with a suggestion to use more idiomatic type conversion for the Shape field.

if c.Shape != "" {
shape := c.Shape
compDefStyles.Shape = (*corev1alpha1.Shape)(&shape)
compDefStyles.Shape = (*core.Shape)(&shape)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This assignment is redundant as it is executed in every iteration of the loop starting at line 181, despite not depending on the loop variable key. For improved efficiency, consider moving the if c.Shape != "" block outside of the loop. Furthermore, the pointer cast (*core.Shape)(&shape) is non-idiomatic; if core.Shape is a defined type (e.g., type Shape string) rather than a type alias, this will cause a compilation error. A more idiomatic approach is to perform a type conversion: s := core.Shape(shape); compDefStyles.Shape = &s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transition UUID usage from direct gofrs/uuid import to schemas core.Uuid

2 participants