MCPcopy Create free account
hub / github.com/parse-community/parse-server / classNameIsValid

Function classNameIsValid

src/Controllers/SchemaController.js:446–456  ·  view source on GitHub ↗
(className: string)

Source from the content-addressed store, hash-verified

444const joinClassRegex = /^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/;
445const classAndFieldRegex = /^[A-Za-z][A-Za-z0-9_]*$/;
446function classNameIsValid(className: string): boolean {
447 // Valid classes must:
448 return (
449 // Be one of _User, _Installation, _Role, _Session OR
450 systemClasses.indexOf(className) > -1 ||
451 // Be a join table OR
452 joinClassRegex.test(className) ||
453 // Include only alpha-numeric and underscores, and not start with an underscore or number
454 fieldNameIsValid(className, className)
455 );
456}
457
458// Valid fields must be alpha-numeric, and not start with an underscore or number
459// must not be a reserved key

Callers 3

fieldTypeIsInvalidFunction · 0.85
validateNewClassMethod · 0.85
deleteFieldsMethod · 0.85

Calls 1

fieldNameIsValidFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…