Using Confluence Server 7.5.2 the field content.metdata.labels a result list which contains the actual labels; it's not just a List<Label>.
Not sure if this changed recently or since which version this is the case?
It is not well documented but looking at the response schema it gives a hint, that metadata.labels is an object and not an array: https://docs.atlassian.com/ConfluenceServer/rest/latest/#api
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 7961] (through reference chain: com.github.crob1140.confluence.requests.GetContentResponse["results"]->java.util.ArrayList[0]->com.github.crob1140.confluence.content.Content["metadata"]->com.github.crob1140.confluence.content.Metadata["labels"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1364)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1140)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1094)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:332)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:265)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1682)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:977)
at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:838)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)
... 12 more
I could create a pull request to fix this. But someone should probably first check if this is a version-specific change or just a bug in this client.
public class Metadata {
private List<Label> labels;
private Version version;
}
Proposed fix: It should probably look more like this
public class Metadata {
private LabelResult labels;
private Version version;
}
public class LabelResult {
private List<Label> results;
}
public class Label {
private LabelPrefix prefix;
private String name;
private String id; <--- should be added
}
Using Confluence Server
7.5.2
the fieldcontent.metdata.labels
a result list which contains the actual labels; it's not just aList<Label>
. Not sure if this changed recently or since which version this is the case? It is not well documented but looking at the response schema it gives a hint, thatmetadata.labels
is anobject
and not anarray
: https://docs.atlassian.com/ConfluenceServer/rest/latest/#apiExample REST response:
I could create a pull request to fix this. But someone should probably first check if this is a version-specific change or just a bug in this client.
Reproducable with:
Currently Metadata.java looks like this:
Proposed fix: It should probably look more like this
Also, in class
Label
the fieldid
is not mapped.