[Feature]: Add recursive whitespace sanitizer to prevent YAML quoting artifacts
- Dominant language
- Go
- Stars
- 223
- Forks
- 225
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 1
Description
**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
### Environment
- **Host OS:** Mac Linux Windows
- **Platform:** Docker or Kubernetes
- **Meshery Server Version:** stable-v
- **Meshery Client Version:** stable-v
---
### Contributor [Guides](https://docs.meshery.io/project/contributing) and [Handbook](https://meshery.io/community#handbook)
- 🛠 [Meshery Build & Release Strategy](https://docs.meshery.io/project/contributing/build-and-release)
- 📚 [Instructions for contributing to documentation](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#documentation-contribution-flow)
- Meshery documentation [site](https://docs.meshery.io/) and [source](https://github.com/meshery/meshery/tree/master/docs)
- 🎨 Wireframes and [designs for Meshery UI](https://www.figma.com/file/SMP3zxOjZztdOLtgN4dS2W/Meshery-UI) in Figma [(open invite)](https://www.figma.com/team_invite/redeem/GvB8SudhEOoq3JOvoLaoMs)
- 🙋🏾🙋🏼 Questions: [Discussion Forum](http://discuss.meshery.io) and [Community Slack](https://slack.meshery.io)
Contributor guide
Research direction
Start by locating the component Configuration map and existing pattern-design utilities in the meshkit repository. Implement the SanitizePattern entry point described in the issue, then add or run focused tests covering nested maps, trimmed string keys and values, and unchanged bool, int, float, and nil values. Done means sanitized output no longer causes YAML quoting artifacts while non-string data is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100