Add generated xdr-json schema files#418
Merged
leighmcculloch merged 2 commits intomainfrom Mar 11, 2025
Merged
Conversation
dmkozh
approved these changes
Mar 10, 2025
fnando
approved these changes
Mar 10, 2025
Member
fnando
left a comment
There was a problem hiding this comment.
nice!
ps: it's funny how this pr made github unusable. 🫠
Member
Author
|
@fnando I was debating limiting the files written to the TransactionEnvelope, at least for the moment, so as not to significantly burden the file system with the +457,000 lines. I'm hoping the GH slowness is just because of the size of the PR, and will not continue once merged. |
leighmcculloch
added a commit
that referenced
this pull request
Mar 18, 2025
* Add generated xdr-json schema files * fix target dependencies order in generate rule (cherry picked from commit 01f4686)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Add generated xdr-json schema files.
Why
So that XDR-JSON schema files can be referenced via a URL for any commit / build / release of the stellar-xdr crate.
So that tooling that embeds the stellar-xdr crate (CLI, Lab, RPC), and supports parsing XDR-JSON and converting from XDR to and from JSON, can also reference a schema URL for IDEs and editors like VS Code that can use JSON schema to auto-complete and provide hints about valid and invalid JSON.
The generated JSON files are checked by CI via the existing
generatejob, that doesn't need updating to do the checks because it broadly checks for any diff after regeneration.As a bonus, after this change is merged, any future changes to the XDR will be more clearly evident as to how they impact the XDR-JSON schema.
Known limitations
This change doesn't yet embed a
$schemakey into JSON generated or parsed yet. It is unclear yet if we will add that here, or not, because not all uses of the XDR-JSON would benefit from it. So applications, like the CLI, that will use it, may do so as needed separately.This change doesn't result in the JSON being served on a particularly friendly URL, but we will be able to use the stellar.org nginx's ability to redirect paths to redirect a nicer stellar.org URL to the files hosted here.
There's an argument for hosting these files outside this repo, however hosting them here is a trade-off towards simplifying the moving parts that support this.
cc @stellar/devx @fnando