bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

Feature Request - Create a Block/View validator

Open SpencerKaiser opened this issue 3 years ago • 6 comments

Description

Many of my Slack projects have 100% test coverage but testing only helps to make sure my handler is working correct, it doesn't help detect when static content like blocks are "broken". For example, if I have view with a title that's too long, the view will compile but will throw a runtime error when used.

Here's what I'd love to have:

// someHandler.test.ts
import 'jest';
import { validator } from '@slack/bolt`;
import { myView } from '../slack/blocks/someHandler';

describe('some functionality including a static view`, () => {
  it('uses a valid view', () => {
    expect(() => validator.validateView(myView)).not.toThrowError();
  });
});

I'm semi-sure it's not possible to improve the types of views/blocks to enforce these types of things, so this seems like the next best thing. Also it seems like yall already have this code somewhere, so it shouldn't be terribly difficult to add!

image

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [x] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] example code related
  • [ ] testing related
  • [ ] discussion

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.

SpencerKaiser avatar Mar 01 '21 15:03 SpencerKaiser

Hey @SpencerKaiser!

Thanks for submitting this feature request! I agree with you it would be nice to have something like this shipping with bolt. We don't currently have bandwidth to work on this but will reevaluate when we do our roadmap planning. As always, we are open to contributions! If it is something you are interested in contributing, I can work with you to get it in!

Thanks again!

stevengill avatar Mar 01 '21 21:03 stevengill

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out.

github-actions[bot] avatar Nov 29 '21 20:11 github-actions[bot]

Setting this issue to a milestone for now, so that it will be surfaced in the next round of roadmap planning!

srajiang avatar Dec 06 '21 22:12 srajiang

This would be an awesome feature.

connorjacobsen avatar Jun 20 '23 17:06 connorjacobsen

This would be a great improvement to developing Slack applications 🙏

philwhln avatar Jan 16 '24 20:01 philwhln