Description
When running miyagi lint, if a single component schema is syntactically invalid (specifically, valid YAML but invalid JSON Schema, such as properties: null), the linter fails for every single component in the project.
The error message reported for every component is identical (e.g., Error: schema is invalid: data/properties must be object), making it impossible to determine which specific file is actually causing the issue without manually checking or debugging every schema file.
Reproduction Steps
- Create a valid Miyagi project with multiple components (e.g.,
button, card, hero).
- Create a new component (e.g.,
social-share) with a schema.yaml that parses to properties: null.
$schema: http://json-schema.org/draft-07/schema
$id: /patterns/social-share
type: object
additionalProperties: false
# This key with no value parses as null in YAML
properties:
- Run
miyagi lint.
Expected Behavior
The linter should fail only for the social-share component and provide an error message indicating that social-share/schema.yaml is invalid. Other valid components should pass linting.
Actual Behavior
The linter reports errors for every single component in the system.
social-share: Reports Error: schema is invalid: data/properties must be object
button (valid): Reports Error: schema is invalid: data/properties must be object
card (valid): Reports Error: schema is invalid: data/properties must be object
This suggests that the validator context is loading all schemas globally to resolve $ref, and a single failure crashes the initialization of the validator for every subsequent check.
Context
- Miyagi Core Version: 4.0.0
- Validator: AJV (via internal dependency)
It appears the validator compiles all project schemas into the context to handle references. When one fails compilation (due to the schema spec requiring properties to be an object, not null), the error bubbles up as a generic failure for the current component being linted, effectively masking the root cause.
Description
When running
miyagi lint, if a single component schema is syntactically invalid (specifically, valid YAML but invalid JSON Schema, such asproperties: null), the linter fails for every single component in the project.The error message reported for every component is identical (e.g.,
Error: schema is invalid: data/properties must be object), making it impossible to determine which specific file is actually causing the issue without manually checking or debugging every schema file.Reproduction Steps
button,card,hero).social-share) with aschema.yamlthat parses toproperties: null.miyagi lint.Expected Behavior
The linter should fail only for the
social-sharecomponent and provide an error message indicating thatsocial-share/schema.yamlis invalid. Other valid components should pass linting.Actual Behavior
The linter reports errors for every single component in the system.
social-share: ReportsError: schema is invalid: data/properties must be objectbutton(valid): ReportsError: schema is invalid: data/properties must be objectcard(valid): ReportsError: schema is invalid: data/properties must be objectThis suggests that the validator context is loading all schemas globally to resolve
$ref, and a single failure crashes the initialization of the validator for every subsequent check.Context
It appears the validator compiles all project schemas into the context to handle references. When one fails compilation (due to the schema spec requiring
propertiesto be an object, not null), the error bubbles up as a generic failure for the current component being linted, effectively masking the root cause.