-
Notifications
You must be signed in to change notification settings - Fork 299
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
Improve options to customize of ConversionService used for GraphQL argument binding #271
Comments
Indeed currently the ConversionService is created in the Boot starter without any option to customize. Not sure if we want to create a dedicated instance for GraphQL, or re-use the ones from Spring MVC and WebFlux. What do you think @bclozel? On the side of As for setting the |
I've made the ConversionService a fixed, internally managed instance within |
Thanks! I'll try it as soon as I can.
|
Good point about DataBinder errors. I've created #280 to address that. |
Spring Boot version: 2.7.0-M1
Spring GraphQL version: 1.0.0-M5
Hello. I faced a problem with arguments resolution when passing them to GraphQL controller methods
I have a declared method accepting some input DTO which may have field of one of the types: OffsetDateTime, ZonedDateTime, LocalDateTime. In terms of GraphQl variables it’s a date-formatted string.
There is also related
graphql.schema.Coercing
responsible for deserialization intojava.time.Instant
. So in general I want to convertjava.time.Instant
into correct date representation.There are several cases where I need customization:
In the first case I need a way to customize ConversionService but without overriding
AnnotatedControllerConfigurer
bean because it may have unpredictable consequences in future (as I'm developing custom library it would be impossible to maintain). For example it would be okay to call conversion service setter in some configuration PostConstruct method, but as for now it won’t have any effect because of hardcoded GraphQlArgumentInitializer at afterPropertySet methodIn the second case there are several problems:
So I think that ConversionService should be passed to DataBinder (something like this
dataBinder.setConversionService(this.typeConverter.getConversionService());
) and there should be an ability to customize ConversionServiceIf there is a workaround or my case is inapplicable I'd like to know about it. Also please check project with issues reproduction https://github.com/MothF/spring-graphql
Thank you in advance.
The text was updated successfully, but these errors were encountered: