Get discount codes for each order line item

Using the following graphql call I’m wondering how I could alter it to also return me the discount code applied for each line item. Currently I’m able to the the total discount applied, but not the code associated with that discount. How would I go about fetching that code?

query {
    node(id: "some id") {
         id
         ... on Order {
             discountCodes
             lineITems (first:10) {
                  id
                 discountAllocations {
                      discountApplication {
                           allocationMethod
                           index
                           targetSelection
                           targetType
                           value
                      }
                 }
             }
         }
    }
}

Thank you for your reply. After trying to implement your suggestion I get this error:

Field ‘discountCodes’ doesn’t exist on type ‘LineItem’

Suggesting that the field is invalid. When looking at the documentation I couldn’t find a reference between discountCodes and LineItem

You need to modify the query as follows:

discountAllocations {
... on AutomaticDiscountApplication {
allocationMethod
index
targetSelection
targetType
title
value
}
... on DiscountCodeApplication {
allocationMethod
code
index
targetSelection
targetType
value
}
... on ManualDiscountApplication {
allocationMethod
description
index
targetSelection
targetType
title
value
}
... on ScriptDiscountApplication {
allocationMethod
index
targetSelection
targetType
title
value
}
} 

I believe the code you are expecting to display is within the DiscountCodeApplication block.

i tried that but it gives me

Fragment on DiscountCodeApplication can’t be spread inside CartDiscountAllocation