Skip to content

Reuse schema properties #1631

Answered by JacobWeisenburger
llermaly asked this question in Q&A
Discussion options

You must be logged in to vote

Does this help?

const jvmSchema = z.object( {
    mem: z.object( {
        heap_used_in_bytes: z.number(),
        heap_used_percent: z.number(),
    } ),
} )

const fsSchema = z.object( {
    total: z.object( {
        total_in_bytes: z.number(),
        free_in_bytes: z.number(),
        available_in_bytes: z.number(),
    } ),
} )

const indicesSchema = z.object( {
    mappings: z.object( {
        total_count: z.number(),
        total_estimated_overhead_in_bytes: z.number(),
    } ),
} )

const attributesSchema = z.object( {
    data: z.string().optional(),
    availability_zone: z.string(),
    server_name: z.string(),
} )

const schema = z.object( {
    jvm: jvmSchema,
    fs: fsSc…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@llermaly
Comment options

@llermaly
Comment options

Answer selected by llermaly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants