Loading files
e942fb8bbThis file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/openharness-1322671404.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
e942fb8bbThis file is pinned to the selected release. Download the original to open it in your design tool.
/** Generate/check the OS handoff schemas from the validators used by the device facade. */
import { readFileSync, writeFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { z } from 'zod'
import { DeviceStoreRequestSchema, DeviceStoreResultSchema } from '../src/lib/autonomous-device/storeContract.js'
for (const [name, schema] of [['request', DeviceStoreRequestSchema], ['response', DeviceStoreResultSchema]] as const) {
const file = fileURLToPath(new URL(`../../docs/contracts/autonomous-device-store-v1/${name}.schema.json`, import.meta.url))
const text = JSON.stringify(z.toJSONSchema(schema, { io: name === 'request' ? 'input' : 'output' }), null, 2) + '\n'
if (process.argv.includes('--check')) {
if (readFileSync(file, 'utf8') !== text) throw new Error(`Contract drift: regenerate ${file} and coordinate the change with Autonomous OS.`)
} else writeFileSync(file, text)
}