Coder Social home page Coder Social logo

Comments (4)

Szandor72 avatar Szandor72 commented on July 21, 2024 1

Happy new year Andrew, no worries!

thanks for your update, I'll report back asap.

from apex-toolingapi.

afawcett avatar afawcett commented on July 21, 2024

Hmmm not sure, would not expect so, can you run this from anonymous apex prompt and capture the actual REST response, this will help determine if its a marshalling issue or not.

from apex-toolingapi.

Szandor72 avatar Szandor72 commented on July 21, 2024

This is the REST response:

{  
   "size":1,
   "totalSize":1,
   "done":true,
   "queryLocator":null,
   "entityTypeName":"ApexClass",
   "records":[  
      {  
         "attributes":{  
            "type":"ApexClass",
            "url":"/services/data/v38.0/tooling/sobjects/ApexClass/01pA0000001AF1eIAG"
         },
         "Id":"01pA0000001AF1eIAG",
         "Name":"MultiAttachment",
         "SymbolTable":{  
            "constructors":[  
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":9,
                     "line":11
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"MultiAttachment",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "type":null
               }
            ],
            "externalReferences":[  

            ],
            "id":"01pA0000001AF1eIAG",
            "innerClasses":[  

            ],
            "interfaces":[  

            ],
            "key":"01pA0000001AF1eIAG",
            "methods":[  
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":29,
                     "line":18
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"getAttachments",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "returnType":"LIST",
                  "type":null
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":14,
                     "line":27
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"addMore",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "returnType":"void",
                  "type":null
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":14,
                     "line":35
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"saveAttachment",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "returnType":"void",
                  "type":null
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":14,
                     "line":51
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"deleteAttachment",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "returnType":"void",
                  "type":null
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":23,
                     "line":59
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"done",
                  "parameters":[  

                  ],
                  "references":[  

                  ],
                  "returnType":"PageReference",
                  "type":null
               }
            ],
            "name":"MultiAttachment",
            "namespace":"ss33a",
            "parentClass":"",
            "properties":[  
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":12,
                     "line":2
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"sobjId",
                  "references":[  

                  ],
                  "type":"Id"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":26,
                     "line":3
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"attachments",
                  "references":[  

                  ],
                  "type":"LIST"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":26,
                     "line":4
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"newAttachments",
                  "references":[  

                  ],
                  "type":"LIST"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":12,
                     "line":6
                  },
                  "modifiers":[  
                     "public"
                  ],
                  "name":"idAttachmentDelete",
                  "references":[  

                  ],
                  "type":"Id"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":30,
                     "line":5
                  },
                  "modifiers":[  
                     "static",
                     "public",
                     "final"
                  ],
                  "name":"NUM_ATTACHMENTS_TO_ADD",
                  "references":[  

                  ],
                  "type":"Integer"
               }
            ],
            "tableDeclaration":{  
               "annotations":[  

               ],
               "location":{  
                  "column":30,
                  "line":1
               },
               "modifiers":[  
                  "public",
                  "without sharing"
               ],
               "name":"MultiAttachment",
               "references":[  

               ],
               "type":"MultiAttachment"
            },
            "variables":[  
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":16,
                     "line":29
                  },
                  "modifiers":[  

                  ],
                  "name":"idx",
                  "references":[  

                  ],
                  "type":"Integer"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":20,
                     "line":36
                  },
                  "modifiers":[  

                  ],
                  "name":"toInsert",
                  "references":[  

                  ],
                  "type":"LIST"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":19,
                     "line":37
                  },
                  "modifiers":[  

                  ],
                  "name":"newAtt",
                  "references":[  

                  ],
                  "type":"Attachment"
               },
               {  
                  "annotations":[  

                  ],
                  "location":{  
                     "column":20,
                     "line":52
                  },
                  "modifiers":[  

                  ],
                  "name":"lstAttDelete",
                  "references":[  

                  ],
                  "type":"LIST"
               }
            ]
         }
      }
   ]
}

the parsed queryresult returns for symbols

VisibilitySymbol:[Symbol.location=Position:[column=26, line=3], Symbol.modifiers=(public), Symbol.name=attachments, Symbol.references=(), Symbol.type_x=null, visibility=null]

Symbol.typ_x=null instead of "type":"LIST" as in the above response

from apex-toolingapi.

afawcett avatar afawcett commented on July 21, 2024

Ok so it is present in the response, and thus the problem is in the deserialisation from JSON to Apex. What I think i see is going on is this.

Since "type" is reserved word in Apex, it cannot be used as a variable name. When using the XML serialiser and deserialiser < type >xxxx< /type > gets automatically mapped to variables named "type_x" to work around this. Hence this might work ok for XML/SOAP version of the API (see main branch) but it looks like the JSON serialiser and deserialiser may not honour this convention.

So i did a bit of googling and found this. Which provides two possible solutions to this problem. The find/replace solution while simple might cause a performance impact depending on how many callouts your making i guess. So if your using the REST API, you could problem insert a line to do the find and replace in this method to try it. Let me know how it goes!

P.S. Sorry for the late reply, been a bit busy with moving and holiday time.

from apex-toolingapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.