beginner-corp/slack

generate typescript declarations from openapi definitions

danprince opened this issue · 7 comments

The current set of typescript declarations have to include an index signature to cover the optional parameters.

https://github.com/smallwins/slack/blob/88931653972942b7738dbeef0308161fe803ed96/slack.d.ts#L52-L62

Looks like we currently scrape these params, then filter them out.

https://github.com/smallwins/slack/blob/88931653972942b7738dbeef0308161fe803ed96/scripts/generate-api-json#L44-L51

Could instead generate an api.json that looked like:

{
  "name": {
    "required": ["token"],
    "optional": ["cursor", "limit"]
  }
}

yep! there's also a rumored swagger defn api "coming soon" so we'll be able to get much more involved ---only caveat I'd ask that we strip those optionals after the typedefs are generated to (again) keep the payload as small as possible! 🙏

Ah sweet. Swagger defs would be good. I'll have a think about how we might do it in the meantime, don't want to make the generation step too complex, just for the sake of TS users.

oh snap! will be interesting to see the delta for our generator scripts (cheers for the release @episod 💯)

think we can close this @danprince ?

I'm still hoping to get this done (currently rock climbing in Thailand though...) so feel free to close it for now and I'll open a PR at some point when I'm back on track.

Sounds like you're totally on track imo! 💪