-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Deprecate Faker::Twitter in favor of Faker::X and update attributes
#3138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Besides renaming the generator to Faker::X, the generator is vastly outdated. Twitter, aka X API, has changed a lot (it's now v2), and most of the attributes being returned in the user have been deprecated: https://docs.x.com/x-api/enterprise-gnip-2.0/fundamentals/data-dictionary#no-longer-supported-deprecated-attributes To maintain backwards compatibility, users still using Faker::Twitter will keep using it but be notified of the upcoming changes. Initially, the goal was to only update the `user` generator but then I realized it wouldn't make sense to leave `status` as it is.
e846c63 to
68d4aa1
Compare
After working on the user generator, it made sense to also deprecate the `status` one. The API migration docs don't mention changing status to tweet, but after inspecting what `status` returns, I realized the new API calls is `tweet`. There were lots of changes for both user and tweet objects. Most notably, the shape of the response, additional fields, and removal of deprecated attributes. Used resources as references: - https://docs.x.com/x-api/migrate/data-format-migration#user-object - https://docs.x.com/x-api/fundamentals/data-dictionary#tweet - https://docs.x.com/x-api/migrate/data-format-migration#entities-and-expanded-entities-objects
68d4aa1 to
f2aa395
Compare
|
The change introduced in #3144 is failing for ruby head. If I add the gem version explicitly back again, tests pass locally. Might be an issue that gets fixed down the road when ruby 4.0 is released? |
cf19b87 to
9b52e23
Compare
thdaraujo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work! 🙏
Faker::Twitter in favor of Faker::X and update attributes
|
created an issue #3147 to fix the problem on CI -> https://github.com/faker-ruby/faker/actions/runs/19600283917/job/56130782276?pr=3138 |
Motivation / Background
Closes #3131
Faker::Twitterhas never been updated since it was introduced. Not only has the platform's name changed, but their objects have changed a lot.After working on the user generator, it made sense to also deprecate the
statusone. The API migration docs don't mention changing status to tweet, but after inspecting whatstatusreturns, I realized the new API calls istweet.There were lots of changes for both user and tweet objects. Most notably, the shape of the response, additional fields, and removal of deprecated attributes. Used resources as references:
Additional information
I will include a noticeable note in the CHANGELOG when this gets released.
The documentation has been updated to reflect the output changes. The changes were made to match the API's new structure as much as possible, however, I took the liberty of excluding some empty fields that faker included in the past. X's API does not return null fields in their response anymore ("X is adopting the convention that JSON values with no value (for example, null) are not written to the payload. Post and user attributes are only included if they have a non-null values." from Updated JSON design).
Examples of the responses:
Faker::X.tweet