[OAS] Implement support for discriminator#249078
Conversation
| * [Custom validation](#custom-validation) | ||
| * [Default values](#default-values) | ||
| * [Extending object schemas](#extending-object-schemas) | ||
| - [`@kbn/config-schema` — The Kibana config validation library](#kbnconfig-schema--the-kibana-config-validation-library) |
There was a problem hiding this comment.
Not related to this PR, just adding missing README entry 🧹
There was a problem hiding this comment.
Also not related, just deleting some unused/legacy code branches
There was a problem hiding this comment.
Also not related, just deleting some unused/legacy code branches
|
/ci |
|
/ci |
|
/ci |
|
/ci |
|
Pinging @elastic/kibana-core (Team:Core) |
|
Is it possible to also add support for an optional "title" value alongside the "id" value (to map to the https://spec.openapis.org/oas/v3.0.3#schema-object |
| 'x-oas-get-additional-properties' as const; | ||
| export const META_FIELD_X_OAS_DEPRECATED = 'x-oas-deprecated' as const; | ||
| export const META_FIELD_X_OAS_DISCRIMINATOR = 'x-oas-discriminator' as const; | ||
| export const META_FIELD_X_OAS_DISCRIMINATOR_CATCH_ALL = 'x-oas-discriminator-catch-all' as const; |
There was a problem hiding this comment.
IIUC this is similar to the default: case in the context of a switch() { ... } statement.
I wonder if the catch-all naming won't be a bit missleading, in the sense that it is not catching errors.
There was a problem hiding this comment.
Yeah, naming stuff is tricky, happy to go with another name here! FWIW this should not be surfaced to end users of the docs in any way.
There was a problem hiding this comment.
Renamed to
export const META_FIELD_X_OAS_DISCRIMINATOR_DEFAULT_CASE =
'x-oas-discriminator-default-case' as const;
...c/src/oas_converter/kbn_config_schema/post_process_mutations/mutations/discriminator.test.ts
Outdated
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Async chunks
History
cc @jloleysens |
Summary
Close #181994
Support generating OAS for
@kbn/config-schema's using our newschema.discriminatedUniontype #246095Notes
{ meta: { id: '...' } }for the objects inside aschema.discriminatedUnionso that we can generate the correct OAS. Guidance for name is as follows:<your-id>-<your-team-or-area>. The intention is that IDs are globally unique while remaining somewhat user readable as they will be surfaced in our docs.Conversion
Given a schema like:
Produce OAS like: