Skip to content

Fix global mappings and aesthetic aliases in validation#306

Open
georgestagg wants to merge 3 commits intomainfrom
fix-validate
Open

Fix global mappings and aesthetic aliases in validation#306
georgestagg wants to merge 3 commits intomainfrom
fix-validate

Conversation

@georgestagg
Copy link
Copy Markdown
Collaborator

@georgestagg georgestagg commented Apr 15, 2026

Currently the following fails validation:

$ ggsql validate 'SELECT x, y FROM data VISUALISE * DRAW point'
✗ Validation errors:
  - Layer 1: Layer 'point' mapping requires the aesthetic '`x`' (or '`y`').

similarly,

ggsql validate 'SELECT date, revenue, region FROM sales VISUALISE date AS x, revenue AS y DRAW line MAPPING region AS color' 
✗ Validation errors:
  - Layer 1: Layer 'line' does not support the `color` mapping. 

This PR ensures both global and local wildcard mappings are handled during validation, and also centralises where aesthetic aliases are defined, resolving them more generally and in methods like is_supported() (so that they can be used for validation).

After this change,

$ ggsql validate 'SELECT x, y FROM data VISUALISE * DRAW point'
✓ Query syntax is valid

Similarly,

$ ggsql validate 'SELECT date, revenue, region FROM sales VISUALISE date AS x, revenue AS y DRAW line MAPPING region AS color'
✓ Query syntax is valid

@georgestagg georgestagg requested a review from thomasp85 April 15, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant