|
87 | 87 | Check whether a dataset name is valid. |
88 | 88 |
|
89 | 89 | Valid names must start with a letter or a number, the rest of the name can also contain `-` |
90 | | -and `_` characters. The names can also be hieracicial, with segments separated by forward |
91 | | -slashes (`/`). Each segment must also start with either a letter or a number. For example: |
| 90 | +and `_` characters. The names can also be hierarchical, with segments separated by forward |
| 91 | +slashes (`/`) or (`.`). Each segment must also start with either a letter or a number. |
| 92 | +
|
| 93 | +For example, the following dataset names are valid: |
92 | 94 |
|
93 | 95 | my_data |
94 | 96 | my_data_1 |
95 | 97 | username/data |
96 | 98 | organization_name/project-name/data |
97 | 99 | 123user/456dataset--name |
| 100 | + username/my_table.csv |
| 101 | + dataset/v0.1.2 |
| 102 | +
|
| 103 | +whereas names like this are invalid: |
| 104 | +
|
| 105 | + __mydata__ |
| 106 | + username/.git |
| 107 | + my...dataset |
| 108 | +
|
| 109 | +!!! note "Segment separators" |
| 110 | +
|
| 111 | + In dataset names, both `/` and `.` are considered segment separators from a syntax |
| 112 | + perspective. While DataSets.jl does not impose any specific interpretation on the |
| 113 | + dataset name, it is recommended to use `/` to separate segments from a semantic |
| 114 | + perspective, and to interpret each forward-slash-separated segment as a path separator. |
| 115 | + Periods would conventionally be used to separate file extensions within a segment. |
| 116 | +
|
| 117 | + E.g. use `username/my-project-data/population.csv`, rather than |
| 118 | + `username.my-project-data.population.csv` or something like that. |
98 | 119 | """ |
99 | 120 | function check_dataset_name(name::AbstractString) |
100 | 121 | if !occursin(DATASET_NAME_REGEX, name) |
101 | | - error("DataSet name \"$name\" is invalid. DataSet names must start with a letter and can contain only letters, numbers, `-`, `_` or `/`.") |
| 122 | + error("DataSet name \"$name\" is invalid. DataSet names must start with a letter or a number, and can contain only letters, numbers, `-` and `_`, or `/` and `.` as segment separators.") |
102 | 123 | end |
103 | 124 | end |
104 | 125 | # DataSet names disallow most punctuation for now, as it may be needed as |
|
0 commit comments