azure-devops-java-sdk icon indicating copy to clipboard operation
azure-devops-java-sdk copied to clipboard

GitChange.changeType: InvalidArgumentValueException: The body of the request contains invalid Json.

Open c4rth opened this issue 2 months ago • 1 comments

Hi,

Since version 6.1.3 and PR #92, the git push returns an error:

org.azd.exceptions.AzDException: InvalidArgumentValueException: The body of the request contains invalid Json.
Parameter name: contentStream
                at org.azd.abstractions.serializer.JsonSerializer.deserialize(JsonSerializer.java:70)
                at org.azd.abstractions.internals.ClientRequestAdapter.execute(ClientRequestAdapter.java:136)
                at org.azd.git.pushes.PushesRequestBuilder.create(PushesRequestBuilder.java:121)

The PR #92 adds a JsonDeserializer for changeType in GitChange. But not a JsonSerializer, so, in the json, changeType is a list instead of a string and the Azure DevOps API throws the error.

e.g.

{
  "commits": [
    {
      "author": {
        "email": "[redacted]",
        "name": "[redacted]"
      },
      "changes": [
        {
          "changeType": [                <-- List of string instead of a string
            "edit"
          ],
          "item": {
            "isFolder": false,
            "isSymLink": false,
            "path": "[redacted]"
          },
          "newContent": {
            "content": "[redacted]",
            "contentType": "base64Encoded"
          }
        },
       ...
      "comment": "[redacted]",
      "commentTruncated": false
    }
  ]
}

c4rth avatar Nov 06 '25 07:11 c4rth

@c4rth, Thanks for reporting. Let me take a look.

hkarthik7 avatar Nov 07 '25 19:11 hkarthik7