Skip to content

feat: support argument types without primaryConstructor #1518

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

Merged

Conversation

samuelAndalon
Copy link
Contributor

📝 Description

there are some use cases where no primary constructor will be defined, like in java classes, for those cases if no primaryConstructor is found use the first element on the constructors list, otherwise throw the error

🔗 Related Issues

#1515

@dariuszkuc
Copy link
Collaborator

Theoretically we could use reflection and attempt to match input map against properties on the object (this is what jackson does) but unsure if we should do it.

@samuelAndalon
Copy link
Contributor Author

i think for ppl using classes without primary constructor, the effort of adding a constructor would be minimal, if we start adding support for matching properties without a constructor we would need to check several use cases ?

@dariuszkuc
Copy link
Collaborator

Yes, matching properties is non trivial - you would need to most likely account for setters and follow Java Beans naming conventions.

It would allow folks to use Java objects but we never targeted that compatibility so I am unsure whether it is worth the effort.

@samuelAndalon samuelAndalon added changes: minor Changes require a minor version module: generator Issue affects the schema generator and federation code labels Aug 16, 2022
@samuelAndalon samuelAndalon merged commit dc3f845 into ExpediaGroup:master Aug 16, 2022
@samuelAndalon samuelAndalon deleted the feat/java-target-constructor branch August 16, 2022 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: minor Changes require a minor version module: generator Issue affects the schema generator and federation code
Development

Successfully merging this pull request may close these issues.

2 participants