Emit unescaped JSON key for type fields#559
Merged
Merged
Conversation
type fields
Contributor
There was a problem hiding this comment.
Pull request overview
Updates generated Rust types and JSON schemas so XDR type fields serialize per SEP-51 while retaining legacy deserialization support.
Changes:
- Adds generated Serde/Schemars field renames from
type_totype. - Preserves
type_as a deserialization alias. - Regenerates affected Rust types and JSON schemas with tests.
Reviewed changes
Copilot reviewed 37 out of 44 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
xdr-generator-rust/generator/src/naming.rs |
Detects keyword-escaped JSON fields. |
xdr-generator-rust/generator/src/generator.rs |
Propagates JSON rename metadata. |
xdr-generator-rust/generator/src/output.rs |
Adds field rename metadata. |
xdr-generator-rust/generator/src/tests/naming.rs |
Tests rename detection. |
xdr-generator-rust/generator/templates/struct.rs.jinja |
Emits Serde aliases and schema renames. |
tests/serde.rs |
Tests current and legacy JSON keys. |
src/generated/contract_event.rs |
Regenerates ContractEvent. |
src/generated/dont_have.rs |
Regenerates DontHave. |
src/generated/sc_spec_event_param_v0.rs |
Regenerates event parameters. |
src/generated/sc_spec_function_input_v0.rs |
Regenerates function inputs. |
src/generated/sc_spec_udt_struct_field_v0.rs |
Regenerates struct fields. |
src/generated/sc_spec_udt_union_case_tuple_v0.rs |
Regenerates union tuple cases. |
src/generated/serialized_binary_fuse_filter.rs |
Regenerates binary fuse filters. |
xdr-json/AuthenticatedMessage.json |
Updates embedded schema key. |
xdr-json/AuthenticatedMessageV0.json |
Updates embedded schema key. |
xdr-json/ContractEvent.json |
Updates schema key. |
xdr-json/DiagnosticEvent.json |
Updates embedded schema key. |
xdr-json/DontHave.json |
Updates schema key. |
xdr-json/InvokeHostFunctionSuccessPreImage.json |
Updates embedded schema key. |
xdr-json/LedgerCloseMeta.json |
Updates embedded schema key. |
xdr-json/LedgerCloseMetaBatch.json |
Updates embedded schema key. |
xdr-json/LedgerCloseMetaV0.json |
Updates embedded schema key. |
xdr-json/LedgerCloseMetaV1.json |
Updates embedded schema key. |
xdr-json/LedgerCloseMetaV2.json |
Updates embedded schema key. |
xdr-json/OperationMetaV2.json |
Updates embedded schema key. |
xdr-json/ScSpecEntry.json |
Updates embedded schema keys. |
xdr-json/ScSpecEventParamV0.json |
Updates schema key. |
xdr-json/ScSpecEventV0.json |
Updates embedded schema key. |
xdr-json/ScSpecFunctionInputV0.json |
Updates schema key. |
xdr-json/ScSpecFunctionV0.json |
Updates embedded schema key. |
xdr-json/ScSpecUdtStructFieldV0.json |
Updates schema key. |
xdr-json/ScSpecUdtStructV0.json |
Updates embedded schema key. |
xdr-json/ScSpecUdtUnionCaseTupleV0.json |
Updates schema key. |
xdr-json/ScSpecUdtUnionCaseV0.json |
Updates embedded schema key. |
xdr-json/ScSpecUdtUnionV0.json |
Updates embedded schema key. |
xdr-json/SerializedBinaryFuseFilter.json |
Updates schema key. |
xdr-json/SorobanTransactionMeta.json |
Updates embedded schema key. |
xdr-json/StellarMessage.json |
Updates embedded schema key. |
xdr-json/TransactionEvent.json |
Updates embedded schema key. |
xdr-json/TransactionMeta.json |
Updates embedded schema key. |
xdr-json/TransactionMetaV3.json |
Updates embedded schema key. |
xdr-json/TransactionMetaV4.json |
Updates embedded schema key. |
xdr-json/TransactionResultMeta.json |
Updates embedded schema key. |
xdr-json/TransactionResultMetaV1.json |
Updates embedded schema key. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leighmcculloch
enabled auto-merge
July 24, 2026 05:30
dmkozh
approved these changes
Jul 24, 2026
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
Fields named
typenow serialize to JSON astypeinstead of the keyword-escapedtype_.Why
SEP-51 says a field's JSON key is its snake_case name with no keyword escaping, so
typemust serialize astype. Sincetypeis a Rust keyword the generator escaped it totype_, which leaked into the JSON and schemas.Close #558
Known limitations
This is a breaking change to the generated JSON: output is now
type, nottype_. Decoding is preserved —type_still deserializes via an alias.