-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix JSON of Slack sample responses #17
Comments
Tested eslint and it would fix the trailing commas. |
Alternatively we could write a simple Ruby class which fixes only the errors that we encounter during parsing. Namely:
Advantages:
Disadvantages:
|
Really slack should fix those, I do suggest opening at least a ticket. In the meantime since it's a hack I would use whatever. |
Btw, @mre work on your fork, don't create branches here and cleanup the merged ones? This way we keep this repo clean. |
Just wanted to add some feedback about my attempts to fix this issue. I've tried to fix the JSON syntax errors with eslint, but there are just too many different error cases. I also tried to add some simple heuristics (basically applying some regular expressions before running eslint), but as expected that made things even more fragile. |
Maybe opening issues with Slack and asking them to provide working examples? Or providing alternate hand-written working examples here that overwrite the worst ones? |
Thanks @dblock, |
There is a comment here from a Slack team member regarding fixing |
The sample responses from the official Slack documentation are often invalid JSON.
For example, check files.upload (because of '...') or im.history (because of a trailing comma in the second message).
Given that slackhq/slack-api-docs is currently not receiving any updates, we should fix that on our side.
I was looking into possible solutions. Unfortunately I did not find any pure-Ruby solution yet. Do you know of any? JSON is tricky to fix automatically. The two most promising solutions I found are:
Both projects promise automatic fixing of JSON.
Since eslint/eslint is well-maintained and offers lots of fixes, I would go with that.
Heads up:
Here is an example of how I would integrate it. I'm not really happy about the code but I couldn't come up with anything better either.
If you like the idea then I would go ahead and integrate it.
Otherwise I'm open for suggestions.
The text was updated successfully, but these errors were encountered: