Support populating columns via URL
Opened this issue · 9 comments
I want to link to Hyperjump with the schema pre-populated. One approach to do so could be so send the schema (possibly encoded) via a query parameter to the application which can be decoded and inserted into the schema pane on the left.
Also if the toggle between JSON and YAML were pages on different routes, that'd make it much more convenient to link to the intended language when supplying the schema via the URL.
This is definitely something I want to support, but I'm not sure how I want it to work.
A base64 encoded blob in a query parameter is not great because the URL can get impractically long.
Another option is to save the schemas somewhere and use an identifier that can then be used to restore the state. I'm not thrilled about that either because I don't want to be storing anyone's schemas.
Ideally I would allow people to login to some third party service that they control where their schemas are stored and who can access them. I looked into using GitHub Gists, but the way the GitHub API works, all the data would have to go through a backend and I don't want access to anyone's data.
So, I still need to come up with a solution for I'm happy with. I'll have more time in a couple months to work on this and other improvements I want to make.
You make many valid points. I'd love to help implement any feasible ideas when something emerges.
Thanks. I'll ping this thread if I come up with something and I'd love to hear if you have any ideas as well.
Oh, please @jdesrosiers, do something like https://json-ld.org/ do with #json-ld=! At the moment I'm using like
For JSON-LD, but JSON Schema, it's no clear if we have some way to just pass a link for visitors to do some quick validation.
About the JSON vs YAML
At least, more advanced options, etc, I think at least allow JSON and minimal funcitonality already is a great start. I'm not even sure if any json-schema website allow quick links like json-ld playground allows it
@jdesrosiers perfect! Yes, I'm aware this is likely to be simpler than the @dhruvkb asked, but likely already be useful for people which already like the JSON-LD playground. I think from what you have now, is mostly wait for entire screen finish load, then check for URL fragments and/or parameters. But as minimalist as might seem, maybe give some small hint for users about how to load external files (be not just a hidden feature).
About the need of CORS, this already totally makes sense! No need to make special tooling for this (let it error on console log). About the test URL I'm using, I think already is with CORS enabled, but I will take note to avoid any additional dependency which might load file from places already without CORS.
I think this is related to the original request, but something like regexr.com where it generates a shortened link with the schema/instance to share. They have a login experience where you can save different regex patterns and they also have community patterns which are common regex patterns to reuse. some of the other cool features are the cheat sheet and reference.
As I mentioned earlier, I'm reluctant to take on the liability, complexity, and cost of storing people's schemas. This project isn't intended to be a full-fledged editor. If there turns out to be a way to integrate with some external persistence the user controls (not me), I'd be willing to do that. Something like solid might be an option, but I haven't had time to look into that.
Circling back to the Gists, the Raw URL for the gists (https://gist.githubusercontent.com/) can be accessed without CORS and without a backend, from the client-side JS. It would be restricted to public gists but that's still great for most use-cases!