Line

You are reading docs for v0.8. See latest (v0.9)

ui/server/src/validateApi

GET /api/validate: runs the same validation construct validate runs (aggregateValidation + DEFAULT_ENFORCERS from the core) against the current project's root and returns the violations as data.

Cockpit server, v0.8. Source: ui/server/src/validateApi.mjs.

Variables#

MAX_VIOLATIONS#

const MAX_VIOLATIONS: 500 = 500

Defined in: ui/server/src/validateApi.mjs:12

Functions#

handleValidate()#

handleValidate(ctx): object

Defined in: ui/server/src/validateApi.mjs:40

Parameters#

ctx
clientOrigin

string

findRoot?

Function = findProjectRoot

log?

any = serverLog

now?

() => number = Date.now

origin?

string

projectDir?

string

validate?

Function = aggregateValidation

Returns#

object

body

body: any

status

status: number


handleValidateForProject()#

handleValidateForProject(ctx): Promise<{ body: any; status: number; }>

Defined in: ui/server/src/validateApi.mjs:69

#541: GET /api/validate honouring the project's project.execution.mode. engine (the default) is exactly handleValidate above, unchanged; cli runs the real construct validate --format json as a subprocess (coreExecutor.mjs) and answers with the same body plus mode, so a CLI failure (timeout, non-zero exit, output that is not the JSON report) shows in the Cockpit as a 502 with the CLI's own words rather than as an empty list. Diagnostics is a core activity; UI-helper endpoints never come through here (see coreExecutor.mjs).

Parameters#

ctx

any

handleValidate's context plus execute? (a runValidate stand-in), execEnv?, cliBin?, timeoutMs?.

Returns#

Promise<{ body: any; status: number; }>