This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
Add base64 URL parameter to allow dynamic schemas #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Currently, the only way to load schema in the play ground directly via the URL is to use the
load
orurl
parameter which requires the schema file to be hosted somewhere and limits the usage.Sending schema as it is in the URL is not possible hence this change allows the users to send the base64 encoded string of their schema and directly load it in the editor.
Implementation
On load, if the base64 URL parameter is present, we decode its value and send it to the editor as it is to create the preview of corresponding schema automatically.
Screenshots and working
For the example, I used the YAML schema from the example present here and to minify the generated base64 encoded string I converted it to JSON and minified it.
Converting to JSON and minifying is completely optional.
Now, on opening this URL locally, I got the following view.