Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Quickstart example #1066

Closed
wants to merge 1 commit into from
Closed

Fix Quickstart example #1066

wants to merge 1 commit into from

Commits on Jul 9, 2024

  1. Fix Quickstart example

    Hello,
    
    Problem:
    
    In the Quickstart of the README, you reference other schema with the `#'<SCHEMA>` syntax. But it doesn't work, it gives `:malli.core/invalid-schema` error.
    
    Steps to reproduce:
    
    1. Start a new REPL with malli in the `deps.edn` file
    2. Paste the code of the Quickstart
    3. When generating with `malli.generator` or validating a handcrafted User object, it always gives the following error : `; :malli.core/invalid-schema {:schema #'user/UserId}`
    
    How to fix:
    
    Just remove the `#'` from schema references. Note that I still get another error `:malli.core/invalid-ref {:ref [:map [:id :string] [:address [:map [:street :string] [:country [:enum "FI" "UA"]]]] [:friends [:set #:gen{:max 2} [:ref #'user/User]]]]}`. It maybe because I don't know how to use `:ref`. But in my real world app removing `#'` totally fixed the problem.
    
    Further suggestion (if I may) :
    
    The Quickstart is the only place I found where you compose a schema out of smaller schema and demonstrate composition through schema reuse. Is it because it's limited? I think it deserves at least a formal documentation like : "You can create a schema with any Schema syntax and just reuse it to compose bigger schema and avoid code duplication` or something like that. You get the point I hope.
    
    Thanks!
    DjebbZ committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    97525dd View commit details
    Browse the repository at this point in the history