Add Validation to Plugin Setting Schema
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 204
- Forks
- 82
- Merge medio
- 22 h 27 min
- PR fusionados (30 d)
- 3
Descripción
We have replaced the config defaults part of the code but have not replaced the field validation part. Validation should be added to the spec. For example, my /atb plugin has the following config field validations:
todoChar: /^(?!(?:.*\*){2})[\*|\-|#{1,}]+$/,
timeBlockHeading: /^[^#+].*/,
workDayStart: /^\d{2}:\d{2}$/,
workDayEnd: /^\d{2}:\d{2}$/,
Maybe this is not MVP, but it should be in the dot-one release of settings. Validation settings should be included in the plugin settings so that Eduard can validate the field that the user has entered. I am going to add a regex field called "validation" (a string with escaped RegEx) to my plugin.settings, e.g.:
"plugin.settings": [
{
"key": "todoChar",
"type": "string",
"validation": "^(?!(?:.*\\*){2})[\\*|\\-|#{1,}]+$",
"choices": ["*","-","#","##","###","####"],
"title": "Time Block Leading Character",
"description": "For NotePlan to recognize a line as a Time Block, the leading character must be one of: a '*', a '-' or one or more '#'s. You can choose between the 3, but if you are going to create real calendar events from your Time Blocks, you must use the *",
"default": "*",
"required": true
}
]
Maybe this is not the ideal example, because there are 'choices', and a user cannot enter other values. But I have many of these, some of which are free-text-entry.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.