-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from Joi to @kbn/config-schema in "home" and "features" plugins #100201
Conversation
currentTimeMarker: Joi.string().isoDate().required(), | ||
currentTimeMarker: schema.string({ | ||
validate(value: string) { | ||
if (isNaN(Date.parse(value))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a valid case to extend @kbn/config-schema
with date
type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. I'm surprised we didn't get any feedback about this type missing to be honest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created #100635
createResults = await client.bulkCreate( | ||
sampleDataset.savedObjects.map(({ version, ...savedObject }) => savedObject), | ||
savedObjects.map(({ version, ...savedObject }) => savedObject), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kbn/config-schema
creates a result type for { property: schema.any() }
, as {property?: any}
. That's okay, since any
includes undefined
or null
types, but it's not compatible with savedObject.attributes
property,(which is a generic, with unknown
default).
@@ -108,6 +108,7 @@ export class APMPlugin | |||
plugins.home?.tutorials.registerTutorial(() => { | |||
const ossPart = ossTutorialProvider({}); | |||
if (this.currentConfig!['xpack.apm.ui.enabled'] && ossPart.artifacts) { | |||
// @ts-expect-error ossPart.artifacts.application is readonly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, consider returning a new object instead of mutating the existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/plugins/home/server/services/sample_data/lib/sample_dataset_schema.ts
Outdated
Show resolved
Hide resolved
currentTimeMarker: Joi.string().isoDate().required(), | ||
currentTimeMarker: schema.string({ | ||
validate(value: string) { | ||
if (isNaN(Date.parse(value))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. I'm surprised we didn't get any feedback about this type missing to be honest.
src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts
Outdated
Show resolved
Hide resolved
|
||
export type InstructionsSchema = TypeOf<typeof instructionSchema>; | ||
|
||
const tutorialIdRegExp = /^[a-zA-Z0-9-]+$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course it's not the same regexp used everywhere
src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts
Outdated
Show resolved
Hide resolved
Pinging @elastic/apm-ui (Team:apm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review only, kibana app code changes LGTM!
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
…ns (elastic#100201) * add a link for issue to remove circular deps * features: migrate from joi to config-schema * update tests * migrate home tutorials to config-schema * migrate home dataset validation to config schema * remove unnecessary type. we cannot guarantee this is a valid SO * address Pierres comments
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…ns (#100201) (#100254) * add a link for issue to remove circular deps * features: migrate from joi to config-schema * update tests * migrate home tutorials to config-schema * migrate home dataset validation to config schema * remove unnecessary type. we cannot guarantee this is a valid SO * address Pierres comments Co-authored-by: Mikhail Shustov <restrry@gmail.com>
…ns (elastic#100201) * add a link for issue to remove circular deps * features: migrate from joi to config-schema * update tests * migrate home tutorials to config-schema * migrate home dataset validation to config schema * remove unnecessary type. we cannot guarantee this is a valid SO * address Pierres comments
Summary
Closes #61100
Unblocks #99899
Migrates
joi
usages to@kbn/config-schema
inhome
andfeatures
pluginsChecklist