How can I get rid of a type generated by the Data/Services return type wizard?
I have a JSON service that returns an object called "error". The Data/Services "Configure Return Type" wizard automatically turned this into a class "Error".
However, this caused over a hundred errors to show up inside the generated classes, "Call to a possibly undefined method Error." That's because of lines like this:
throw new Error(propertyName + " is not a data property of entity Agreements");
It's trying to throw a regular "Error" object, but now that there's an "Error" class in the same package, that is taking precedence--and that Error object doesn't have a constructor with a single parameter. At least, that's what I think is going on.
I tried to fix it by deleting _ErrorEntityMetadata.as, _Super_Error.as, and Error.as from the valueObjects package. I then opened the FML file and deleted the definition for the entity "Error" and every reference to the Error entity (class) in my FML file.
I then changed my JSON service so that it returns an object called "serviceError" instead of just "error".
But, whenever I re-run the "Configure Return Type" wizard, it regenerates the Error class, even though I've deleted it from everywhere I can find it. That breaks my project completely! How can I end this and get Flash Builder to *stop* generating this type!
In the "Configure Return Type" wizard I very carefully inspected the type of every bit of data coming back to make sure none of them show up as type "Error." And they don't (as expected, since I changed the object's name to serviceError--now the type of that object is ServiceError.
I think you are facing this known issue https://bugs.adobe.com/jira/browse/FB-29770
Please vote it.
Thanks for the link--I just voted for it.
To avoid this, in the last page of "Configure Return Type", edit return type name to something else (You can also edit subnodes's name too in the wizard).
Actually, that's exactly what I saw doing; I apologize if that wasn't clear in my post.
I closed and restarted Flash Builder, and once I did that Flash Builder stopped generating the Error class. My guess is that the FML file, even though I had updated it (by deleting all references to the Error class), was cached in some fashion by Flash Builder, and restarting Flash Builder forced it to reread the FML file?
Additional point of clarification: my understanding is that the FML file stores all the metadata about the services that Flash Builder has been able to figure out so far, and when you run the Configure Return Type wizard, it will regenerate *every* type in the FML file, even if that type is not mentioned anywhere in the particular return value that you are working with.
Edited to provide additional thoughts on FML file.