deercreeklabs / lancaster

Apache Avro library for Clojure and ClojureScript
Other
60 stars 5 forks source link

problems with larger schemas #32

Closed mpisanko closed 12 months ago

mpisanko commented 12 months ago

Created the following schema (using lancaster 0.12.2, clojure 1.11.1, openjdk 11, also tried openjdk19). Getting an error:

Syntax error compiling at (avro/grid_settings.clj:9:3).
Unable to resolve symbol: ​:hybrid-color in this context

also tried the def-record-schema macro - with same result.

(ns avro.grid-settings
  (:require [deercreeklabs.lancaster :refer [record-schema
                                             def-array-schema
                                             string-schema
                                             int-schema
                                             boolean-schema]]))

(def grid-settings-schema
  (record-schema :grid-settings-schema
   [[:folio-user string-schema]
    [:listen-color​ string-schema]
    [:local-color​ string-schema]
    [​:hybrid-color string-schema]
    [​:eod-color string-schema]
    [​:broadcast-color string-schema]
    [​:eod-eval-date string-schema]
    [​:chart-menu-options string-schema]
    [:curves​ string-schema]
    [:pages​ string-schema]
    [:spreader-data​ string-schema]
    [:eod-off boolean-schema]
    [:local-off​ boolean-schema]
    [:listen-off​ boolean-schema]
    [:broadcast-off​ boolean-schema]
    [:hybrid-off​ boolean-schema]
    [:alternating-row-color​ boolean-schema]
    [:qtr-switch​ boolean-schema]
    [:hlv-switch​ boolean-schema]
    [:cal-switch​ boolean-schema]
    [:qtr-current​ boolean-schema]
    [:cal-current​ boolean-schema]
    [​:hlv-current boolean-schema]
    [:adhoc-spreads-switch​ boolean-schema]
    [:wrap-charts​ boolean-schema]
    [:show-all-periods​ boolean-schema]
    [:quarters-border​ boolean-schema]
    [:condensed-mode​ boolean-schema]
    [:max-charts int-schema]
    [:months int-schema]
    [:qtrs int-schema]
    [:hlvs int-schema]
    [:cals int-schema]
    [:adhoc-spreads-rows int-schema]
    [:updated​ string-schema]]))

(def-array-schema grid-settings
  grid-settings-schema)
chadharrington commented 12 months ago

@mpisanko Thank you for the bug report and the helpful reproduction. I will dig into this on the weekend.

chadharrington commented 12 months ago

@mpisanko The problem is that you have a Zero Width Space (U+200B) immediately before the colon in :hybrid-color. That causes the Clojure compiler to choke. Remove that, and all works fine. I will close this issue now. Feel free to re-open if you have any additional concerns related to this issue.

mpisanko commented 12 months ago

awesome!! thanks for this - TIL about zero width space - and not even sure how it got there in the first place. could have been some (spac)emacs shenanigans..