Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement replace_segment attribute #197

Merged
merged 4 commits into from
Oct 20, 2023
Merged

Implement replace_segment attribute #197

merged 4 commits into from
Oct 20, 2023

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Oct 19, 2023

This implements the replace_segment attribute. This attribute can be used to rename one or multiple segments returned by TypeInfo::path. It could be for example be used to rename a changed crate name. For more info see the examples and the docs in this pr.

This implements the `replace_segment` attribute. This attribute can be
used to rename one or multiple segments returned by `TypeInfo::path`. It
could be for example be used to rename a changed crate name. For more
info see the examples and the docs in this pr.
@bkchr bkchr requested review from ascjones, jsdw and lexnv October 19, 2023 21:19
bkchr added a commit to paritytech/polkadot-sdk that referenced this pull request Oct 19, 2023
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit.

derive/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Small nit: we'd also need an entry in the changelog if we plan to release from this PR 🙏

@bkchr bkchr merged commit 68c85ee into master Oct 20, 2023
2 checks passed
@bkchr bkchr deleted the bkchr-replace-segment branch October 20, 2023 08:16
franciscoaguirre added a commit to paritytech/polkadot-sdk that referenced this pull request Oct 20, 2023
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
acatangiu pushed a commit to acatangiu/polkadot-sdk that referenced this pull request Oct 30, 2023
)

The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Morganamilo pushed a commit to paritytech/polkadot-sdk that referenced this pull request Nov 14, 2023
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
franciscoaguirre added a commit to paritytech/xcm that referenced this pull request Jan 25, 2024
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
)

The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.

This requires: paritytech/scale-info#197

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants