Can't deserialize valid ViewSubmissionPayload string
Issue Type
TODO:
Place an x in one of the [ ].
- [x] Bug
- [ ] Enhancement / Feature request
- [ ] Question
- [ ] Documentation
Description
When i tried to deserialize valid block kit builder template to ViewSubmissionPayload, i've got an error message saying com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $.hint seems like schema is outdated, i've been using
<!-- https://mvnrepository.com/artifact/com.github.seratch/jslack -->
<dependency>
<groupId>com.github.seratch</groupId>
<artifactId>jslack</artifactId>
<version>3.4.2</version>
</dependency>
which is last available version of the lib, example of the modal i submit
https://api.slack.com/tools/block-kit-builder?mode=modal&view=%7B%22type%22%3A%22modal%22%2C%22title%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22text%22%2C%22emoji%22%3Atrue%7D%2C%22submit%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22Submit%22%2C%22emoji%22%3Atrue%7D%2C%22close%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22Cancel%22%2C%22emoji%22%3Atrue%7D%2C%22blocks%22%3A%5B%7B%22type%22%3A%22input%22%2C%22element%22%3A%7B%22type%22%3A%22plain_text_input%22%2C%22action_id%22%3A%22query%22%2C%22multiline%22%3Atrue%2C%22placeholder%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22placeholder%22%7D%7D%2C%22label%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22text%22%7D%2C%22hint%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22ssome%20useful%20hint%22%7D%7D%5D%7D
the way i deserialize it
Gson snakeCase = GsonFactory.createSnakeCase();
ViewSubmissionPayload viewSubmissionPayload = snakeCase.fromJson(payload, ViewSubmissionPayload.class);
System.out.println(viewSubmissionPayload);
(only for a bug report)
The issue is reproducible in:
- Module Version: 3.4.2
- JDK Version: 1.8.0_221
The steps to reproduce are:
- submit the modal above
- deserialize with the snakeCase
- got an error message
The expected result is: expect to have ViewSubmissionPayload created
The actual result is: got an error message com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $.hint
Requirements (place an x in each of the [ ])
- [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
@stressedoutt Thanks for reporting this. The issue was reported by #410 and I've resolved it by https://github.com/slackapi/java-slack-sdk/commit/f975dbd1fcc76e02e1d1944b8f84a973910efd3d
However, the change is not yet backported to jSlack maintenance releases. I've filed a ticket in the project. https://github.com/seratch/jslack-maintenance-releases/issues/11 As I'll update you at the jslack-maintenance-releases project, please allow me to close this.
Besides this bug, if you have a chance, I'd recommend migrating to java-slack-sdk. New feature supports will be available only in this project. Also, the migration should be really easy. Only you need to do is change package imports for most.
thanks a lot for your fast reply, let me try the java-slack-sdk instead
thanks again, works like a charm