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

plantuml and dot transform fail with custom registry #1060

Open
ieugen opened this issue May 19, 2024 · 1 comment
Open

plantuml and dot transform fail with custom registry #1060

ieugen opened this issue May 19, 2024 · 1 comment

Comments

@ieugen
Copy link

ieugen commented May 19, 2024

Hi,

I've reported this on slack https://clojurians.slack.com/archives/CLDK6MFMK/p1716113560108419 and https://clojurians.slack.com/archives/CLDK6MFMK/p1716110401656839

Some more info there

This is a repro:

(ns user 
  (:require [malli.experimental.time.generator]
            [malli.experimental.time :as mt]
            [malli.core :as m]
            [malli.registry :as mr]
            [malli.generator :as mg]
            [malli.plantuml :as plantuml]
            [malli.dot :as md]))

(def snm-schema {"Curve" [:enum :curve25519 :p256]})

(def r
  (mr/composite-registry
   m/default-registry
   (mr/registry (mt/schemas))
   (mr/registry snm-schema)))

(comment
  (mg/generate "Curve" {:registry r})
  ;; => :p256

  (plantuml/transform ["Curve"] {:registry r})
  ;; => Execution error (ExceptionInfo) at malli.core/-exception (core.cljc:136).
  ;;    :malli.core/invalid-schema

  (md/transform ["Curve"] {:registry r})
  ;; => Execution error (ExceptionInfo) at malli.core/-exception (core.cljc:136).
  ;;    :malli.core/invalid-schema

  )

ambrosebs
16 minutes ago
Apparently the registry needs to be embedded in the schema atm.
(println (plantuml/transform [:schema {:registry {"Curve" [:enum :curve25519 :p256]}} "Curve"]))
@startuml
entity Curve {
[:enum :curve25519 :p256]
}
@enduml

ambrosebs
5 minutes ago
maybe ref handling needs an overhaul here. recursive schemas also don't work.

@frenchy64
Copy link
Collaborator

I take that back, recursive schemas seem to work. I forgot to add a :ref in recursive places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants