mirror of
https://github.com/versia-pub/docs.git
synced 2025-12-06 06:18:19 +01:00
refactor: ♻️ Remove extension_type in favour of using the type field on entities
This commit is contained in:
parent
228ef3c98d
commit
596b42474f
|
|
@ -36,4 +36,6 @@ This page lists changes since Working Draft 03. {{ className: 'lead' }}
|
|||
- Add `algorithm` to [Users](/entities/user) and [InstanceMetadata](/entities/instance-metadata)'s public keys for future use (only `ed25519` is allowed for now).
|
||||
- Renamed the second `public_key` to `key`.
|
||||
- Renamed `Announce` to [Share](/extensions/share).
|
||||
- Renamed `prev` to `previous` in [Collections](/structures/collection).
|
||||
- Renamed `prev` to `previous` in [Collections](/structures/collection).
|
||||
- Removed `extension_type` from entities, and instead use the `type` field.
|
||||
- Removed `VoteResult` from the [Polls Extension](/extensions/polls).
|
||||
|
|
@ -27,7 +27,7 @@ Having the authorization is defined as:
|
|||
URI of the `User` who is deleting the entity. [Can be set to `null` to represent the instance](/entities/instance-metadata#the-null-author).
|
||||
</Property>
|
||||
<Property name="deleted_type" type="string" required={true}>
|
||||
Type of the entity being deleted. In case of extensions, use the entity's `extension_type`.
|
||||
Type of the entity being deleted.
|
||||
</Property>
|
||||
<Property name="target" type="URI" required={true} typeLink="/types#uri">
|
||||
URI of the entity being deleted.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Any field in an entity not marked as `required` may be omitted or set to `null`.
|
|||
Unique identifier for the entity. Must be unique within the instance. Can be any string. Max of 512 UTF-8 characters.
|
||||
</Property>
|
||||
<Property name="type" type="string" required={true}>
|
||||
Type of the entity. Only types defined in the Versia protocol are allowed. Use an [Extension](/extensions) if you want to define custom types.
|
||||
Type of the entity. Custom types must follow [Extension Naming](/extensions#naming).
|
||||
</Property>
|
||||
<Property name="created_at" type="ISO8601" required={true} typeLink="/types#iso-8601">
|
||||
Date and time when the entity was created. Must be an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted string.
|
||||
|
|
@ -59,8 +59,7 @@ Any field in an entity not marked as `required` may be omitted or set to `null`.
|
|||
```jsonc {{ 'title': 'With Extensions' }}
|
||||
{
|
||||
"id": "f0aacf0b-df7a-4ee5-a2ba-6c4acafd8642",
|
||||
"type": "Extension",
|
||||
"extension_type": "org.space:Zlorbs/Zlorb",
|
||||
"type": "org.space:Zlorbs/Zlorb",
|
||||
"created_at": "2023-04-13T08:00:00Z",
|
||||
"uri": "https://space.org/zlorbs/f0aacf0b-df7a-4ee5-a2ba-6c4acafd8642",
|
||||
"extensions": { // [!code focus:100]
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ Instance **must** be the host of the instance the user is on (hostname with opti
|
|||
followers: URI;
|
||||
following: URI;
|
||||
featured: URI;
|
||||
// Same format as extension_type on Extensions
|
||||
// Same format as type on Extensions
|
||||
[key: ExtensionsKey]: URI;
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Likes are a way for users to show appreciation for a note, like Twitter's "heart
|
|||
<Row>
|
||||
<Col>
|
||||
<Properties>
|
||||
<Property name="extension_type" type="string" required={true}>
|
||||
<Property name="type" type="string" required={true}>
|
||||
Must be `pub.versia:likes/Like`.
|
||||
</Property>
|
||||
<Property name="author" type="URI" required={true} typeLink="/types#uri">
|
||||
|
|
@ -36,8 +36,7 @@ Likes are a way for users to show appreciation for a note, like Twitter's "heart
|
|||
```jsonc {{ 'title': 'Example Like' }}
|
||||
{
|
||||
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
"type": "Extension",
|
||||
"extension_type": "pub.versia:likes/Like",
|
||||
"type": "pub.versia:likes/Like",
|
||||
"created_at": "2021-01-01T00:00:00.000Z",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe",
|
||||
"uri": "https://example.com/likes/3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
|
|
@ -57,7 +56,7 @@ Dislikes are a way for users to show disapproval for a note, like YouTube's "dis
|
|||
<Row>
|
||||
<Col>
|
||||
<Properties>
|
||||
<Property name="extension_type" type="string" required={true}>
|
||||
<Property name="type" type="string" required={true}>
|
||||
Must be `pub.versia:likes/Dislike`.
|
||||
</Property>
|
||||
<Property name="author" type="URI" required={true} typeLink="/types#uri">
|
||||
|
|
@ -74,8 +73,7 @@ Dislikes are a way for users to show disapproval for a note, like YouTube's "dis
|
|||
```jsonc {{ 'title': 'Example Dislike' }}
|
||||
{
|
||||
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
"type": "Extension",
|
||||
"extension_type": "pub.versia:likes/Dislike",
|
||||
"type": "pub.versia:likes/Dislike",
|
||||
"created_at": "2021-01-01T00:00:00.000Z",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe",
|
||||
"uri": "https://example.com/dislikes/3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
|
|
|
|||
|
|
@ -87,9 +87,6 @@ Extensions can be found in two places: an [Entity](/entities#entity-definition)'
|
|||
<Col>
|
||||
<Properties>
|
||||
<Property name="type" type="string" required={true}>
|
||||
The entity type. **Must** be `Extension`. The extension type is defined in the `extension_type` property.
|
||||
</Property>
|
||||
<Property name="extension_type" type="string" required={true}>
|
||||
The extension type. [Must follow naming conventions](#naming).
|
||||
</Property>
|
||||
<Property name="other">
|
||||
|
|
@ -103,8 +100,7 @@ Extensions can be found in two places: an [Entity](/entities#entity-definition)'
|
|||
|
||||
```jsonc {{ title: "Example Custom Entity" }}
|
||||
{
|
||||
"type": "Extension",
|
||||
"extension_type": "com.example:poll/Poll",
|
||||
"type": "com.example:poll/Poll",
|
||||
"id": "6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"uri": "https://example.com/actions/6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe",
|
||||
|
|
|
|||
|
|
@ -95,6 +95,9 @@ If a vote is cast to a poll that is closed, the vote should be rejected with a `
|
|||
<Row>
|
||||
<Col>
|
||||
<Properties>
|
||||
<Property name="type" type="string" required="true">
|
||||
Must be `pub.versia:polls/Vote`.
|
||||
</Property>
|
||||
<Property name="author" type="URI" required="true" typeLink="/types#uri">
|
||||
URI to the user who cast the vote.
|
||||
</Property>
|
||||
|
|
@ -112,8 +115,7 @@ If a vote is cast to a poll that is closed, the vote should be rejected with a `
|
|||
```jsonc {{ title: "Example Vote" }}
|
||||
{
|
||||
"id": "6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"type": "Extension", // [!code focus:2]
|
||||
"extension_type": "pub.versia:polls/Vote",
|
||||
"type": "pub.versia:polls/Vote", // [!code focus]
|
||||
"uri": "https://example.com/actions/6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"created_at": "2021-01-01T00:00:00.000Z",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe", // [!code focus:3]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ User reactions are (like every other entity) federated to all followers, and can
|
|||
<Row>
|
||||
<Col>
|
||||
<Properties>
|
||||
<Property name="extension_type" type="string" required>
|
||||
<Property name="type" type="string" required>
|
||||
Must be `pub.versia:reactions/Reaction`.
|
||||
</Property>
|
||||
<Property name="author" type="URI" required typeLink="/types#uri">
|
||||
|
|
@ -38,8 +38,7 @@ User reactions are (like every other entity) federated to all followers, and can
|
|||
```jsonc {{ title: "Example Entity" }}
|
||||
{
|
||||
"id": "6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"type": "Extension", // [!code focus:2]
|
||||
"extension_type": "pub.versia:reactions/Reaction",
|
||||
"type": "pub.versia:reactions/Reaction", // [!code focus]
|
||||
"uri": "https://example.com/actions/6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
||||
"created_at": "2021-01-01T00:00:00.000Z",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe", // [!code focus:3]
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ When a user shares a note, the note's original author **must** receive the entit
|
|||
<Row>
|
||||
<Col>
|
||||
<Properties>
|
||||
<Property name="extension_type" type="string" required={true}>
|
||||
<Property name="type" type="string" required={true}>
|
||||
Must be `pub.versia:share/Share`.
|
||||
</Property>
|
||||
<Property name="author" type="URI" required={true} typeLink="/types#uri">
|
||||
|
|
@ -35,8 +35,7 @@ When a user shares a note, the note's original author **must** receive the entit
|
|||
```jsonc {{ 'title': 'Example Share' }}
|
||||
{
|
||||
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
"type": "Extension",
|
||||
"extension_type": "pub.versia:share/Share",
|
||||
"type": "pub.versia:share/Share",
|
||||
"created_at": "2021-01-01T00:00:00.000Z",
|
||||
"author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe",
|
||||
"uri": "https://example.com/shares/3e7e4750-afd4-4d99-a256-02f0710a0520",
|
||||
|
|
|
|||
Loading…
Reference in a new issue