Skip to content

[Feature]: Add recursive whitespace sanitizer to prevent YAML quoting artifacts #1036

Description

@YASHMAHAKAL

Current Behavior:
Meshkit currently lacks a utility to recursively sanitize configuration maps within pattern designs. If a user accidentally leaves trailing whitespace in a string value or map key, those spaces are left intact in the design. When downstream serialization libraries (like yaml.v3) export these designs to Kubernetes manifests, they are forced by the YAML specification to preserve the spaces by wrapping the fields in single quotes (e.g., 'storage ': 1Gi or name: 'test-volume '), which breaks Kubernetes validation.

Desired Behavior:
Provide a robust utility function (SanitizePattern) that traverses a component's Configuration map and recursively trims leading and trailing whitespace from all string keys and string values. This utility must be strictly type-safe—passing non-string types (like bool, int, float, and nil) through unchanged to guarantee it does not corrupt schema data.

Screenshots/Logs

Image

Environment

  • Host OS: Mac Linux Windows
  • Platform: Docker or Kubernetes
  • Meshery Server Version: stable-v
  • Meshery Client Version: stable-v

Contributor Guides and Handbook

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions