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

MissingFieldException error in BitBucketServerReviewer #210

Open
astoriawinter opened this issue Mar 25, 2022 · 3 comments
Open

MissingFieldException error in BitBucketServerReviewer #210

astoriawinter opened this issue Mar 25, 2022 · 3 comments

Comments

@astoriawinter
Copy link

Hello! I build danger-kotlin from sources, and when I try to run (I use bitbucket)
danger-kotlin *stash_pull_request_number* --dangerfile=Dangerfile.df.kts I get such error:

kotlinx.serialization.MissingFieldException: Field 'lastReviewedCommit' is required for type with serial name                 
'systems.danger.kotlin.models.bitbucket.BitBucketServerReviewer', but it was missing
    at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
    at systems.danger.kotlin.models.bitbucket.BitBucketServerReviewer.<init>(BitBucketServer.kt:233)
    at systems.danger.kotlin.models.bitbucket.BitBucketServerReviewer$$serializer.deserialize(BitBucketServer.kt:233)
    at systems.danger.kotlin.models.bitbucket.BitBucketServerReviewer$$serializer.deserialize(BitBucketServer.kt:233)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
    at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
    at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
    at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
    at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
    at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
    at systems.danger.kotlin.models.bitbucket.BitBucketServerPR$$serializer.deserialize(BitBucketServer.kt:195)
    at systems.danger.kotlin.models.bitbucket.BitBucketServerPR$$serializer.deserialize(BitBucketServer.kt:195)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
    at systems.danger.kotlin.models.bitbucket.BitBucketServer$$serializer.deserialize(BitBucketServer.kt:13)
    at systems.danger.kotlin.models.bitbucket.BitBucketServer$$serializer.deserialize(BitBucketServer.kt:13)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
    at systems.danger.kotlin.models.danger.DangerDSL$$serializer.deserialize(DangerDSL.kt:14)
    at systems.danger.kotlin.models.danger.DangerDSL$$serializer.deserialize(DangerDSL.kt:14)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
    at systems.danger.kotlin.models.danger.DSL$$serializer.deserialize(DangerDSL.kt:9)
    at systems.danger.kotlin.models.danger.DSL$$serializer.deserialize(DangerDSL.kt:9)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
    at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)
    at systems.danger.kotlin.MainDangerRunner.<init>(MainDangerRunner.kt:131)
    at systems.danger.kotlin.MainScriptKt.Danger(MainScript.kt:49)
    at Dangerfile_df.<init>(Dangerfile.df.kts:6)

I saw same issue with gitlab #145, I guess it's related to default argument. Can it be fixed?

@gianluz
Copy link
Member

gianluz commented Apr 4, 2022

please see #211, should fix the issue

@astoriawinter
Copy link
Author

@gianluz Hi, also faced same error with emailAddress in BitBucketServerUser. Email can be null, as user that created PR could be deleted. Please, add fix to this case as well.

@msarelo
Copy link
Contributor

msarelo commented Jan 25, 2023

@gianluz
Possibly a lot of data in BitBucket server responses could be nullable. I got two different errors:

  1. emailAddress in my cases when Bitbucket added some automatic comment.
  2. field tasks in BitBucketServerCommentDetail in my case is also nullable and got this error:
kotlinx.serialization.MissingFieldException: Field 'tasks' is required for type with serial name 'systems.danger.kotlin.models.bitbucket.BitBucketServerCommentDetail', but it was missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants