Alfresco / rest-api-explorer

Public REST API Explorer
Apache License 2.0
37 stars 25 forks source link

Remove incorrectly documented ContentInfo required fields #114

Closed agologan closed 3 years ago

agologan commented 3 years ago

The fields are documented as required but ACS doesn't return them in certain situations. mimeTypeName isn't always returned by search while sizeInBytes isn't returned by rendition calls.

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

agologan commented 3 years ago

Not with JS-API but with the Swift and Kotlin bindings which are both statically typed and crash when deserializing because of it breaks the contract. In JS the required contract isn't even enforced as far as I can tell: https://github.com/Alfresco/alfresco-ng2-components/blob/develop/lib/content-services/src/lib/document-list/models/document-library.model.ts#L65

gavincornwell commented 3 years ago

@agologan Ah OK, do you mean that Swift and Kotlin code crashes at runtime because the generated code is expecting those objects to be present (as they are defined as required) but they're not.

So the change you've made fixes the runtime crash?

agologan commented 3 years ago

Exactly, both Kotlin and Swift have the concept on an optional value to ensure safety. A required field becomes a non-optional parameter on the class strongly enforcing that contract and ending up in a deserialization exception when in fact it's an incorrectly defined contract (swagger defintion).