Comments (4)
Happy new year Andrew, no worries!
thanks for your update, I'll report back asap.
from apex-toolingapi.
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.
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.
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)
- Port old ToolingAPIDemo.cls to new SOAP Edition HOT 3
- Should we rename project branches to clearly show type? HOT 2
- Retrieving only 2000 custom fields HOT 2
- Unable to cast ApexClass into sobject_x when calling the create method. HOT 4
- Unable to get the type of List/Set/Map added as parameter to a method HOT 1
- Unable to QUERY ValidationRule, throws GACK error HOT 3
- Invalid conversion from runtime type List<ToolingAPIWSDL.sObject_x> to List<ToolingAPIWSDL.CustomObject> HOT 2
- Create Call INVALID_TYPE: Must send a concrete entity type HOT 8
- Question: retrieving metadata from HOT 2
- EntityDefinition field missing on ValidationRule HOT 4
- Error getting retrieving metadata on FieldDefinition HOT 1
- Getting Error HOT 2
- References of methods from Symbol Table = null HOT 3
- showing that ToolingAPI.CustomObjects is an invalid type. HOT 8
- Getting WorkflowOutboundMessage Id HOT 1
- Tests fail only during package upload - "CalloutException uncommitted work pending HOT 1
- Fetch workflow rules and validation rules
- WSDL question HOT 2
- Fetching Health Check Score and RiskTypes from the Org into the Code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apex-toolingapi.