feat: add support for vendor extensions#245
Conversation
Introduces support to custom renderer for vendor extensions, by adding a new property named `renderExtensionAddon` which will call when vendor properties (properties prefixed with `x-`) are find the schema definition.
|
@billiegoose @daniel-white @brendarearden If someone could have a look at this would be great! |
|
@P0lip Can you have a look? |
P0lip
left a comment
There was a problem hiding this comment.
Looks good overall! Thanks for the PR.
I'd appreciate it if you added a test - LMK if you have a question regarding that. Happy to help if needed
src/utils/extractVendorExtensions.ts
Outdated
| * @returns VendorExtensionsResult | ||
| */ | ||
| export function extractVendorExtensions(fragment: SchemaFragment = {}): VendorExtensionsResult { | ||
| const extensionKeys = Object.keys(fragment).filter(key => key.toLowerCase().startsWith('x-')); |
There was a problem hiding this comment.
I'm not sure we should lower-case the key. If a key starts with an upper-cased X-, then IMHO it shouldn't be considered a spec ext.
|
Thanks, I will update the PR ASAP. I need to solve some work tasks first |
* master: fix: improve handling of array + dictionary combo (stoplightio#251) feat: support dictionaries (stoplightio#249) # Conflicts: # src/components/SchemaRow/TopLevelSchemaRow.tsx
|
@P0lip Sorry, I was on vacation for Chinese New Year. I have updated the PR now. Please let me know, what you think of it :) |
|
Anymore changes needed? I would love to be able to stop maintaining a fork of |
|
I'll merge it tomorrow. |
|
Awesome excited 👯♀️ :) Thank you! 🙏 |
|
@P0lip Would you be able to merge it? Love to raise a PR in Elements to bump with this support :) |
|
🎉 This PR is included in version 4.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
Awesome thank you 👯 |
Motivation and Context
Adds support for rendering vendor extensions as part of a schema row or the top level schema
Fixes #236
Description
Introduces support to custom renderer for vendor extensions, by adding a new property named
renderExtensionAddonwhich will call when vendor properties (properties prefixed withx-) are find the schema definition.How Has This Been Tested?
Tested in production for our internal documentation
Screenshot(s)/recordings(s)
Rendering of a vendor extension that shows the

x-stoplightextension, in this example, it only returns a React element for any extensions with a nesting level higher than 0Types of changes
Checklist