Skip to content

Commit

Permalink
Update doc comment for offeringBasedSchema (#184223)
Browse files Browse the repository at this point in the history
## Summary

Updates the doc comment to callout that this utility should only be used
to validate Kibana config.
  • Loading branch information
jloleysens authored May 27, 2024
1 parent a2c2f65 commit 57b2555
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/kbn-config-schema/src/helpers/offering_based_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import { Type, TypeOptions } from '../types';
/**
* Helper to apply different validations depending on whether Kibana is running the Serverless or Traditional offering.
*
* @remark This utility is intended to be used for Kibana YAML-based configuration validation only! Using it in other
* contexts will lead to only `traditional` validation being used.
*
* If you want to switch schemas based on the offering in other contexts do the following:
*
* ```ts
* // env is passed to your plugin constructor
* const schema = env.packageInfo.buildFlavor === 'serverless' ? baseSchema.extend(a) : baseSchema.extend(b);
* ```
*
* @example Only allow the setting on Serverless
* const config = schema.object({
* myProp: offeringBasedSchema({ serverless: schema.boolean({ defaultValue: true }) }),
Expand Down

0 comments on commit 57b2555

Please sign in to comment.