bdelacretaz commented on pull request #1:
URL: 
https://github.com/apache/sling-org-apache-sling-graphql-core/pull/1#issuecomment-653508306


   I have merged the feature branch into master and marked 
https://issues.apache.org/jira/browse/SLING-9550 resolved accordingly, for 
basic scalars support. We can still rediscuss the API if needed, preferably on 
the Sling dev list as others might also have an opinion.
   
   ## How to register external converters without the 
SlingScalarConvertersProvider
   
   As for registering wrappers for existing scalar converters (to avoid the 
`SlingScalarConvertersProvider` service that this PR suggests) it's basically 
what the 
[TestUtil.registerSlingScalarConverter](https://github.com/apache/sling-org-apache-sling-graphql-core/blob/9bc163cd7eab8b7c3a1ab107656253aa9ebb5e2a/src/test/java/org/apache/sling/graphql/core/mocks/TestUtil.java#L39)
 method does:
   
       BundleContext bc = ...injected in activate method
       SlingScalarConverter converter = new ConverterWrapper(converterToWrap);
       final Dictionary<String, Object> props = new Hashtable<>();
       props.put(SlingScalarConverter.NAME_SERVICE_PROPERTY, name);
       bc.registerService(SlingScalarConverter.class, converter, props);
   
   So if you have a set of `converterToWrap`, just run this in a loop. This can 
happen in the `activate` method of an OSGi Component for example, and the 
converters just need to be registered before running the first GraphQL query.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to