Closed mdesantis closed 2 months ago
What you're doing is probably the best way to change refs at the moment. I'm curious, what is the use case for doing that?
I'm curious, what is the use case for doing that?
Basically these are my mappers:
module ShaleMappers
class Model < Shale::Mapper
model ::Model
...
Which would make the $defs
key to be ShaleMappers_Model
but I'd like to have just Model
. Also, in case of a model namespace, I'm not enthusiast of having _
as separator, I'd like to use something else (I was even thinking of /
, but I'm new to JSON schemas so I'm unsure it makes sense), so yeah stuff like this
UPDATE Actually, I was wrong about the ShaleMappers_Model
point, I've just realized I miswrote the model
forgetting the ::
, that's why ShaleMappers_
was included in the $defs
key. But the argument about the _
still remains.
(btw thanks for this library, I love that it doesn't have any open issues nor pull requests so much that opening one made me sad :joy: )
Thanks. Like I said, for now I would stick to what you're doing currently. I might implement it in the future, but for now I don't have much free time.
Suppose you have the following code:
You get
But, what if you want a
$defs
key and$ref
calculated differently from the current logic? This is the cleanest way I've figured out so far:Which gives
But it's quite cumbersome. What about something like
Another option I guess would be to pass
defs_key
toas_schema
, e.g.:But I'm new to JSON schemas, I don't know which one makes more sense