-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
Current Behavior
When a structured data object uses a @type that is not a valid schema.org type (e.g., "@type": "BananaPhone"), the validator silently skips it without returning any error or warning.
Currently:
- If the type has no registered handler in
validator.js, it logs a debug warning and returns an empty array - The
schemaOrg.jsglobal handler only validates properties, not the type itself - Users receive no feedback that their type is invalid
Expected Behavior
The validator should return a warning when a @type is not a valid schema.org type, helping users catch typos or made-up types early.
Proposed Implementation
-
Modify
schemaOrg.jsto check if the type exists in the loaded schema.org specification before validating properties:const schema = await this.#loadSchema(); const typeId = this.#stripSchema(this.type); if (!schema[typeId]) { issues.push({ issueMessage: `Type "${typeId}" is not a valid schema.org type`, severity: 'WARNING', path: this.path, errorType: 'schemaOrg', fieldName: '@type', }); return issues; }
-
Modify
validator.jsto ensure the schemaOrg handler runs even for types without a registered handler (so completely unknown types are also validated)
Acceptance Criteria
- Validator returns a warning for types not found in schema.org specification
- Warning includes the invalid type name and path
- Valid schema.org types (even without specific handlers) do not trigger warnings
- Add test cases for invalid type validation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels