Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
9 months ago

Possible to set custom code samples for Request Samples?

Originally posted by user Alexi - Work to the Stoplight Community on 08/29/2023 at 15:28 ET.

Hello, I am currently evaluating Stoplight against a few alternatives for OpenAPI documentation. Currently, it looks like all of the examples in the code sample section are set to make HTTP calls in the given language.

The product we would be documenting, however, will have it's own SDK, and we'd like any displayed code samples to reflect that usage. Rather than showing how to make an HTTP call in the selected language, we'd like to provide idiomatic examples that leverage our SDK instead.

Is it currently possible to do so in Stoplight? I didn't see anything in the docs, but may have missed it. If not, is it possible to disable the code samples altogether? We may prefer not to show anything if we can't customize them.

  • Stoplight's avatar
    Stoplight
    Community Manager

    Skinghar (Staff) [08/31/2023 - 16:51 ET]

    Hello Alexi, Unfortunately we do not have this as a feature. However, we suggest another option would be to turn off the "try-it" functionality off in your workspace settings, which will disable those code samples.

    We suggest going to the "description field" in each API Endpoint using markdown https://meta.stoplight.io/docs/platform/b591e6d161539-stoplight-flavored-markdown-smd to share your SDK samples there. This is a workaround to achieve what you might desire.

    We encourage you to enter a feature request here: https://roadmap.stoplight.io/tabs/7-under-consideration/submit-idea with your ideas.

    • Stoplight's avatar
      Stoplight
      Community Manager

      Alexi - Work (OP) [08/31/2023 - 17:13 ET]

      Good to know about the ability to turn off the try it examples, as well as the suggested workaround. Thank you! I'll write up a bit more context and submit the above as a feature request