Skip to content

Update slice name validation documentation to match actual regex requirements #241

@gajeshbhat

Description

@gajeshbhat

Summary

The current documentation for slice name validation in the slice definitions reference is inaccurate compared to the actual regex validation in the code.

Current Documentation

"The slice names must consist only of lower case letters(a-z), digits(0-9) and minus (-) signs. They must be at least three characters long and must start with an alphanumeric character."

Actual Regex

var SnameExp = regexp.MustCompile(`^([a-z](?:-?[a-z0-9]){2,})$`)

Issues

  1. "start with an alphanumeric character" - The regex requires starting with [a-z] (lowercase letter only), not alphanumeric
  2. "consist only of lower case letters(a-z), digits(0-9) and minus (-) signs" - This is imprecise. Hyphens can only appear when followed by a letter or digit, not anywhere

Suggested Fix

Update the documentation to reflect the regex pattern accurately:

"Slice names must start with a lowercase letter, be at least 3 characters long, and each subsequent character must be either a lowercase letter/digit or a hyphen followed by a lowercase letter/digit."

Context

This came up during work on issue #158 in the PR #240 where we improved the error message for invalid slice names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions