Custom SDK/Code Samples #1138
Replies: 9 comments 10 replies
-
I'm not too keen on the Never got around to proving it out but I always thought it could be interesting to leverage a simple templating language like mustache etc to allow end users to more programmatically produce code samples for operations in a scalable way. |
Beta Was this translation helpful? Give feedback.
-
At Xero we started down this route and had SDK specific code samples for each of our 6 languages. It handled things like enums, and expected object structure and casing conventions. However was quickly un-maintainable. We use HtmlDocs2 to generate our docs, and refactored the 6 example route to instead store more param/field level metadata for our 6 sdks. Then in the mustache templates we use all the vendor extension meta to build up SDK specific examples. However - this is still not super maintainable and embeds a lot of extra meta data that is very tied to the logic of each languages HtmlDocs2 mustache templates. End result: OAS w/ meta to create dynamic code samples
|
Beta Was this translation helpful? Give feedback.
-
@philsturgeon Hi, is there any progress on this feature? |
Beta Was this translation helpful? Give feedback.
-
I think x-code-samples would work. The backend can programmed to generate the code sample as it's api changes. |
Beta Was this translation helpful? Give feedback.
-
Having |
Beta Was this translation helpful? Give feedback.
-
I haven't been able to get this to work either. We're currently using the What we currently have:
|
Beta Was this translation helpful? Give feedback.
-
Hi @dbrian57, this is not an implemented feature. We're discussing the potential implementation to see if that would solve the use case for people. It seems like you would like it to work this way, and tbh I don't know of a better solution yet so perhaps we should consider this to be the way to go? @mnaumanali94 what do you think? |
Beta Was this translation helpful? Give feedback.
-
Hi @philsturgeon and @mnaumanali94, that would be amazing. We just like to maintain our own code samples for certain languages. Thanks for getting back to me so quickly! |
Beta Was this translation helpful? Give feedback.
-
Hello. Elements rocks, however to go production with it, I would like to know if this feature is planned for soon or still on the pipe / backlog ? Thanks. |
Beta Was this translation helpful? Give feedback.
-
User story.
As an end user of API docs I can see an example of the SDK code for any given operation so long as its defined.
Is your feature request related to a problem?
Currently we help out the majority of users who do not have a custom SDK developed, meaning they immediately have code their end users can use to make requests. For the advanced minority who have their own SDKs, this is a step backwards.
Describe the solution you'd like
The closest thing the OpenAPI community has to a standard way to handle code samples is the
x-codeSamples
vendor extension started by our friends over at ReDoc.Beta Was this translation helpful? Give feedback.
All reactions