Skip to content
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

TransactionLineItem should contain Product instead of ProductWithIncludes #10

Closed
wants to merge 2 commits into from

Conversation

Invincibear
Copy link
Contributor

The disclaimer at the top of the file says the code is auto-generated, I'm not positive this is a bug but according to the API spec, it seems that this should be using Product instead of ProductWithIncludes. Also, had to submit as a PR because GitHub discussions doesn't seem to be enabled for this repo. I haven't looked into TransactionLineItemPreview yet, I suspect it'll need the save review.

ProductWithIncludes -> Product
@Invincibear Invincibear requested a review from a team January 28, 2024 05:28
@Invincibear Invincibear changed the title Update TransactionLineItem.php TransactionLineItem should contain Product instead of ProductWithIncludes Jan 28, 2024
@Invincibear
Copy link
Contributor Author

Invincibear commented Jan 28, 2024

Yeah after looking at the API reference it appears that TransactionLineItemPreview also needs to reference Product instead of ProductWithIncludes

@Invincibear
Copy link
Contributor Author

Invincibear commented Jan 28, 2024

Looks like this might actually be a larger issue. I'm working through the ProductsClient and it has similar issues, methods returning ProductWithIncludes when it should only be returning Product. I think only get & list methods should return Entities with WithIncludes. I think a lot of this library needs to have the methods checked against the API docs for Includes.

@mikeymike
Copy link
Contributor

Hey @Invincibear thanks for bringing this up it's a very important point. We made a decision early on that the way entities with includes work within the API specification isn't strictly ideal for the PHP type system where we'd result in 2 implementations of effectively the same entity making it trickier for consumers to reason with and pass objects around their codebase. When we made this decision we chose to utilise the EntityWithIncludes objects instead with some cleanup code required in the code generation to prevent the duplication.

I've created a new PR #15 that should hopefully clean this up now, I'll close this PR and the related one in favour of this.

Thanks again for highlighting this 👍

@mikeymike mikeymike closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants