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

Add items_total to linkintegrity endpoint #1636

Merged
merged 17 commits into from
Aug 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 24 additions & 23 deletions docs/source/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ myst:
This upgrade guide lists all breaking changes in `plone.restapi`.
It explains the steps that are needed to upgrade to the latest version.

## Upgrading to `plone.restapi` 9.x
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@davisagli can you check that what I wrote here is correct?

Copy link
Sponsor Member Author

@davisagli davisagli Aug 25, 2023

Choose a reason for hiding this comment

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

@tisto yes, basically, but one nuance: The endpoint accepts multiple UIDs. Before, objects with no breaches were left out of the result. Now they are always included, so that we can also show how many items are contained. So, the old result might not be an empty list if multiple UIDs were requested (I.e. multiple checkboxes selected to delete in folder contents) and some of them have breaches

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@davisagli not sure I fully get this. Could you add this to the upgrade guide?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@davisagli I merged this PR, feel free to add to main or create a new PR.


### Link Integrity

When calling the @linkintegrity endpoint in `plone.restapi` before 9.0.0, a content object with no link integrity breaches would return just an empty list in the response body:

`[]`

In `plone.restapi` 9.0.0, the following response would be returned with a `breaches` attribute with an empty list:

```
[
{
"@id": "http://localhost:55001/plone/doc-2",
"@type": "Document",
"breaches": [],
"description": "",
"items_total": 0,
"review_state": "private",
"title": "Second document",
"type_title": "Page"
}
]
```

## Upgrading to `plone.restapi` 8.x

Expand All @@ -20,15 +44,13 @@ Upgrading to `plone.restapi` 8.x does not require any changes to your code base

If you use Python 2 and a Plone version older than 5.2, stick with `plone.restapi` 7.x.


## Upgrading to `plone.restapi` 7.x

The navigation endpoint has been refactored.
Now its behavior is consistent regarding the `items` attribute.
Now the `items` attribute is present, even if the element of the tree does not have child elements, in which case it will be an empty array.
This might affect some logins via JavaScript, specifically if the condition is checking for the existence of the `items` attribute and expects it to be `undefined`.


## Upgrading to `plone.restapi` 6.x

`plone.restapi` 6.0.0 removes the `IAPIRequest` marker interface (<https://github.com/plone/plone.restapi/pull/819>).
Expand All @@ -52,7 +74,6 @@ If you need to fix object IDs, you can do one of the following:
We expect that most content actually will not be affected.
See <https://github.com/plone/plone.restapi/issues/827> for more details.


## Upgrading to `plone.restapi` 5.x

`plone.restapi` 5.0.0 introduces the following breaking change:
Expand Down Expand Up @@ -96,7 +117,6 @@ to:
This change affects the `GET`, `PATCH`, and `POST` formats.
It should only affect you if you use Volto.


## Upgrading to `plone.restapi` 4.x

`plone.restapi` 4.0.0 introduces the following breaking changes:
Expand All @@ -106,7 +126,6 @@ It should only affect you if you use Volto.
3. Serialize widget parameters into a `widgetOptions` object instead of adding them to the top level of the schema property.
4. The vocabularies endpoint does no longer returns an `@id` for terms, the results are batched, and terms are now listed as `items` instead of `terms` to match other batched responses.


### Serialization and Deserialization of fields with vocabularies

The serialization of fields with vocabularies, such as `Choice`, now return the `token` and the `title` of the vocabulary term instead of the stored value.
Expand Down Expand Up @@ -148,7 +167,6 @@ Deserialization accepts objects that contain a token, but also just the token or

However, it is highly recommended to always use the token, as vocabulary terms may contain values that are not JSON serializable.


### Choice and List fields return link to vocabulary instead of the values

Choice and List fields using named vocabularies are now serialized with a `vocabulary` property, giving the URL of the `@vocabularies` endpoint for the vocabulary instead of including `choices`,
Expand Down Expand Up @@ -185,7 +203,6 @@ New response:
},
```


### Serialize widget parameters into a `widgetOptions` object

Serialize widget parameters into a `widgetOptions` object instead of adding them to the top level of the schema property.
Expand All @@ -207,7 +224,6 @@ New response:
}
```


### Example: Vocabularies Subjects Field

The `subjects` field is now serialized as an `array` of `string` items using the `plone.app.vocabularies.Keywords` vocabulary.
Expand Down Expand Up @@ -241,7 +257,6 @@ New response:
}
```


### Example: Available Time Zones Field (vocabulary in `items`)

Old response:
Expand Down Expand Up @@ -297,7 +312,6 @@ New response:
},
```


### Example: Weekday Field (vocabulary in main property)

Old response:
Expand Down Expand Up @@ -371,7 +385,6 @@ New response:
},
```


### Vocabularies Endpoint

The vocabularies endpoint no longer returns an `@id` for terms.
Expand Down Expand Up @@ -412,10 +425,8 @@ New response:
}
```


## Upgrading to `plone.restapi` 3.x


### Image scales

Image download URLs and image scale URLs are created using the UID-based URL formats.
Expand Down Expand Up @@ -457,7 +468,6 @@ New Response:
}
```


### `@sharing` endpoint

The `available_roles` property in the response to a `GET` request to the `@sharing` endpoint has changed.
Expand Down Expand Up @@ -515,7 +525,6 @@ Content-Type: application/json
}
```


### Custom Content Deserializers

If you have implemented custom content deserializers, you have to handle the new `create` keyword in the `__call__` method, which determines if deserialization is performed during object creation or while updating an object.
Expand All @@ -524,13 +533,11 @@ Deserializers should only fire an `IObjectModifiedEvent` event if an object has

See [Dexterity content deserializer](https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/deserializer/dxcontent.py) for an example.


## Upgrading to `plone.restapi` 2.x

`plone.restapi` 2.0.0 converts all datetime, DateTime and time objects to UTC before serializing.
The translations endpoint becomes "expandable", which introduces the following breaking changes.


### Translations

Previously when using the `@translations` endpoint in `plone.restapi` 1.x, the endpoint returned a `language` key with the content object's language and a `translations` key with all its translations.
Expand Down Expand Up @@ -575,7 +582,6 @@ Content-Type: application/json
}
```


## Upgrading to `plone.restapi` 1.0b1

In `plone.restapi` 1.0b1 the `url` attribute on the {ref}`navigation` and {ref}`breadcrumbs` endpoint was renamed to `@id` to be consistent with other links/URLs used in `plone.restapi`.
Expand Down Expand Up @@ -728,7 +734,6 @@ Pull Request:

- <https://github.com/plone/plone.restapi/pull/459>


## Upgrading to `plone.restapi` 1.0a25

`plone.restapi` 1.0a25 introduced three breaking changes:
Expand All @@ -739,7 +744,6 @@ Pull Request:
- Convert `richtext` using `.output_relative_to`.
Direct conversion from `RichText` is no longer supported as we _always_ need a context for the `ITransformer`. [jaroel]


### Remove @components endpoint

`plone.restapi` 1.0a25 removed the `@components` endpoint which used to provide a {ref}`navigation` and a {ref}`breadcrumbs` endpoint.
Expand Down Expand Up @@ -777,7 +781,6 @@ Pull Request:

- <https://github.com/plone/plone.restapi/pull/425>


### Remove `sharing` attribute

The `sharing` attribute was removed from all content `GET` responses:
Expand All @@ -799,7 +802,6 @@ Pull Request:

- <https://github.com/plone/plone.restapi/commit/1b5e9e3a74df22e53b674849e27fa4b39b792b8c>


### Convert `richtext` using `.output_relative_to`

Use `.output_relative_to` to convert `richtext`.
Expand All @@ -813,7 +815,6 @@ Pull Request:

- <https://github.com/plone/plone.restapi/pull/428>


## Upgrading to `plone.restapi` 1.0a17

`plone.restapi` 1.0a17 changed the serialization of the `richtext` "text" field for content objects from using `raw` (a Unicode string with the original input markup):
Expand Down