facebook-business-sdk-codegen icon indicating copy to clipboard operation
facebook-business-sdk-codegen copied to clipboard

Creation of AdSet suffers from breaking changes

Open kirsar opened this issue 2 years ago • 1 comments

Checklist

  • [x] I've updated to the latest released version
  • [x] I've searched for existing GitHub issues
  • [x] I've looked for existing answers on Stack Overflow and the Facebook Developers Group
  • [x] I've read the Code of Conduct
  • [x] This issue is not security related and can safely be disclosed publicly on GitHub

Environment

  • Node Version: 16.15.0
  • NPM Version: 8.5.5

Goals

Be able to use strongly-typed programming without type casting when creating API resources, as it was possible before v13

Expected Results

I expect existing code using facebook-java-business-sdk which creates AdSet in particular to compile without errors There are no breaking changes introduced in v13 changelog related to AdSet creation https://developers.facebook.com/docs/graph-api/changelog/version13.0

Actual Results

Compilation error due to:

before commit

public static class APIRequestCreateAdSet extends APIRequest<AdSet>

after

public static class APIRequestCreateAdSet extends APIRequest<APINode>

before commit

public APIRequestCreateAdSet setBillingEvent (AdSet.EnumBillingEvent billingEvent)

after

public APIRequestCreateAdSet setBillingEvent (EnumBillingEvent billingEvent)

image

There are more enums which suffered from additional enum definition copies added There are more entities which lost strongly-typed api One can observe the same in node.js sdk returning Promise<AbstractObject>

Steps to Reproduce

Try to compile examples

Steps to Fix

Restore return type back to "AdSet" in spec

Restore "node" property on "adaccountadsets_billing_event_enum_param" back to "AdSet" in spec

I'd be happy to create PR, but commit tells the spec was "Automitically generate from our internal API framework." which I don't have access to.

I can confirm java sdk is fully compilable after mentioned changes

I might be missing something, since I just joined a java project and learning java for 5 days and fb business api for 1.5 days, but it'd be so nice to leave the code as is without typecasting.

kirsar avatar Jun 16 '22 18:06 kirsar

Seeing the same issue. v12 gets deprecated around Aug 9th, so we'll have to roll out fix or do type casting 😮‍💨

hsabbathi avatar Jul 12 '22 13:07 hsabbathi