You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/src/reference/registry-index.md
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -205,6 +205,40 @@ explaining the format of the entry.
205
205
The JSON objects should not be modified after they are added except for the
206
206
`yanked` field whose value may change at any time.
207
207
208
+
> **Note**: The index JSON format has subtle differences from the JSON format of the [Publish API] and [`cargo metadata`].
209
+
> If you are using one of those as a source to generate index entries, you are encouraged to carefully inspect the documentation differences between them.
210
+
>
211
+
> For the [Publish API], the differences are:
212
+
>
213
+
> *`deps`
214
+
> *`name` --- When the dependency is [renamed] in `Cargo.toml`, the publish API puts the original package name in the `name` field and the aliased name in the `explicit_name_in_toml` field.
215
+
> The index places the aliased name in the `name` field, and the original package name in the `package` field.
216
+
> *`req` --- The Publish API field is called `version_req`.
217
+
> *`cksum` --- The publish API does not specify the checksum, it must be computed by the registry before adding to the index.
218
+
> *`features` --- Some features may be placed in the `features2` field.
219
+
> Note: This is only a legacy requirement for [crates.io]; other registries should not need to bother with modifying the features map.
220
+
> The `v` field indicates the presence of the `features2` field.
221
+
> * The publish API includes several other fields, such as `description` and `readme`, which don't appear in the index.
222
+
> These are intended to make it easier for a registry to obtain the metadata about the crate to display on a website without needing to extract and parse the `.crate` file.
223
+
> This additional information is typically added to a database on the registry server.
224
+
>
225
+
> For [`cargo metadata`], the differences are:
226
+
>
227
+
> *`vers` --- The `cargo metadata` field is called `version`.
228
+
> *`deps`
229
+
> *`name` --- When the dependency is [renamed] in `Cargo.toml`, `cargo metadata` puts the original package name in the `name` field and the aliased name in the `rename` field.
230
+
> The index places the aliased name in the `name` field, and the original package name in the `package` field.
231
+
> *`default_features` --- The `cargo metadata` field is called `uses_default_features`.
232
+
> *`registry` --- `cargo metadata` uses a value of `null` to indicate that the dependency comes from [crates.io].
233
+
> The index uses a value of `null` to indicate that the dependency comes from the same registry as the index.
234
+
> When creating an index entry, a registry other than [crates.io] should translate a value of `null` to be `https://github.com/rust-lang/crates.io-index` and translate a URL that matches the current index to be `null`.
235
+
> *`cargo metadata` includes some extra fields, such as `source` and `path`.
236
+
> * The index includes additional fields such as `yanked`, `cksum`, and `v`.
0 commit comments