stoplightio / elements

Build beautiful, interactive API Docs with embeddable React or Web Components, powered by OpenAPI and Markdown.
https://stoplight.io/open-source/elements/
Apache License 2.0
1.74k stars 201 forks source link

feat: add ability to override code examples using `x-codeSamples` #2574

Closed weyert closed 4 months ago

weyert commented 5 months ago

Elements Default PR Template

In general, make sure you have: (check the boxes to acknowledge you've followed this template)

Updates the RequestSamples and TryItWithExamples-components to support the x-codeExamples vendor extension on a http operation schema.

refs #2453

netlify[bot] commented 5 months ago

Deploy Preview for stoplight-elements ready!

Name Link
Latest commit ec84034af4befae7d5db1d255b3a9d53be953dcd
Latest deploy log https://app.netlify.com/sites/stoplight-elements/deploys/664b84291ea50c0008154970
Deploy Preview https://deploy-preview-2574--stoplight-elements.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 5 months ago

Deploy Preview for stoplight-elements-demo ready!

Name Link
Latest commit ec84034af4befae7d5db1d255b3a9d53be953dcd
Latest deploy log https://app.netlify.com/sites/stoplight-elements-demo/deploys/664b8429842de70008d51c84
Deploy Preview https://deploy-preview-2574--stoplight-elements-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mnaumanali94 commented 5 months ago

@weyert Hey! Thank you for the contribution. Were you going for x-codeexamples or was it supposed to be x-codesamples?

x-codesamples is generally what we see being used in the industry.

weyert commented 5 months ago

Oh sorry, my bad. I am happy to update it. You are totally right. I am not sure if we would like to remap support mappings from other views (E.g. redly) to the values that Elements is expecting?

brendarearden commented 5 months ago

I am not sure if we would like to remap support mappings from other views (E.g. redly) to the values that Elements is expecting?

I am not sure what you mean by this? is redly using a different overriding code example x extension?

weyert commented 5 months ago

I am not sure if we would like to remap support mappings from other views (E.g. redly) to the values that Elements is expecting?

I am not sure what you mean by this? is redly using a different overriding code example x extension?

Sorry, I meant Redocly and others might use a different naming convention for the language, e.g. shell vs bash etc. I think we are fine for Read.me version of doing this, though.

brendarearden commented 5 months ago

Sorry, I meant Redocly and others might use a different naming convention for the language, e.g. shell vs bash etc. I think we are fine for Read.me version of doing this, though.

Gotcha. We don't need to do the remapping as part of this, but would you open a separate issue for the remapping?

weyert commented 5 months ago

Gotcha. We don't need to do the remapping as part of this, but would you open a separate issue for the remapping?

Sure, happy to do that.

weyert commented 4 months ago

Hmm, bummer, wondering if it's incorrect management of the isStale-variable?

weyert commented 4 months ago

Don't want to sound rude but I would prefer Stoplight's resources would be spend on my other PR https://github.com/stoplightio/elements/pull/2545 which would allow me to stop using my fork of Elements. This PR was just a nice improvement.

brendarearden commented 4 months ago

@weyert this PR overlapped with a feature request from our product team, so it was a higher priority in the backlog. I appreciate you letting us know though and we will make sure your other PR is moved up in priority! hopefully we will be able to get you unforked soon!

weyert commented 4 months ago

Thank you for merging :)