-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Inventory][ECO] Replace Entity
with InventoryEntityLatest
type
#198760
Changes from all commits
ad95291
99cd0d4
b23fae2
8ba7131
9321024
5155dcf
cb96542
b0d66b1
bd28149
0334bfc
8a49c1c
be5cc41
8ef786e
de12d05
8d8df1c
29551e2
595ac73
185696f
b463ccc
33832dc
1620988
a186a60
b046148
3f06d21
3ccdac2
38ffdc2
ebf9c58
423b2a8
f087c7d
38c7370
a370ab3
535568b
21dd1a9
3b5540d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ import { arrayOfStringsSchema } from './common'; | |
export const entityBaseSchema = z.object({ | ||
id: z.string(), | ||
type: z.string(), | ||
identity_fields: arrayOfStringsSchema, | ||
identity_fields: z.union([arrayOfStringsSchema, z.string()]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
display_name: z.string(), | ||
metrics: z.record(z.string(), z.number()), | ||
metrics: z.optional(z.record(z.string(), z.number())), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps we should remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The framework still supports metrics even if the Inventory doesn't use it, let's leave this for now |
||
definition_version: z.string(), | ||
schema_version: z.string(), | ||
definition_id: z.string(), | ||
|
@@ -24,10 +24,13 @@ export interface MetadataRecord { | |
} | ||
|
||
const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]); | ||
|
||
type Literal = z.infer<typeof literalSchema>; | ||
type Metadata = Literal | { [key: string]: Metadata } | Metadata[]; | ||
interface Metadata { | ||
[key: string]: Metadata | Literal | Literal[]; | ||
} | ||
export const entityMetadataSchema: z.ZodType<Metadata> = z.lazy(() => | ||
z.union([literalSchema, z.array(entityMetadataSchema), z.record(entityMetadataSchema)]) | ||
z.record(z.string(), z.union([literalSchema, z.array(literalSchema), entityMetadataSchema])) | ||
); | ||
|
||
export const entityLatestSchema = z | ||
|
@@ -39,3 +42,6 @@ export const entityLatestSchema = z | |
), | ||
}) | ||
.and(entityMetadataSchema); | ||
|
||
export type EntityInstance = z.infer<typeof entityLatestSchema>; | ||
export type EntityMetadata = z.infer<typeof entityMetadataSchema>; |
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.
Removed #198902