fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.69k stars 151 forks source link

[Feature] Limit language for Endpoint Request Snippet #5242

Open aweaver89 opened 13 hours ago

aweaver89 commented 13 hours ago

Problem description

Under certain situations, you don't really need users to see all available snippets. It would be very helpful to be able to define which language(s) you want to display in the Endpoint Request Snippet component

Why would it be useful?

If you're taking a customer through an example built for using the API in Go (for example) and want to show the pre-generated code but in a nice component, there is currently no way to make it so that this sample is pulled directly from your code samples and only one is displayed.

Moreover, when using these blocks as a part of more custom built html, it's sometimes easier to control if you only have a single sample to work with.

Describe the solution (optional)

Add a lang=[] option that would use the same values as the sdk parameter x-fern-samples. This way you could easily add lang=[curl, python] to the EndpointRequestSnippet component and only show these.

Additional context

I actually recently ran into an issue where I wanted to use this component and ended up building quite a lot of custom html. The issue in the end was that when you changed samples the size of the element changed and then caused it to run over other components. It was perfect for curl and I would have been fine just leaving it with a single sample.