npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ouas/validator

v1.0.0

Published

OUAS Layout Config validation engine — schema validation, manifest checking, constraint verification, and config migration

Downloads

124

Readme

@ouas/validator

The OpenUI Adaptive Standard (OUAS) Validation Engine.

This package implements the core 7-step validation pipeline and config migrator. It ensures that any Layout Config generated by an AI agent is syntactically correct, matches the application's manifest, complies with custom component-level constraints, and is perfectly safe to render.


Installation

pnpm add @ouas/validator
# or
npm install @ouas/validator

Core Features

1. 7-Step Validation Pipeline

The validator runs the following sequence of checks:

  1. Schema Check: Validates layout config structure against the standard JSON Schema via Ajv. Also enforces a strict 4KB size limit on configs to prevent payload bloat.
  2. App ID Matching: Ensures config.app_id matches manifest.app_id.
  3. Component Existence: Ensures every component ID used exists in the Manifest.
  4. Field Existence: Confirms all referenced fields are valid options on that specific component.
  5. Required Fields Check: Validates that all fields marked as required in the manifest are present in visible_fields in the layout.
  6. Constraint Rules: Verifies custom restrictions (e.g., matching the manifest's min_fields_visible rules).
  7. Data Source Validation: Checks component-to-data-source bindings for structural mismatches.

2. Layout Schema Validation

Checks metadata rules, string bounds, and region count limits (maximum 20 regions).

3. Config Migrator

Migrates older config JSON objects to work with newer versions of the Component Manifest standard using version markers.


API & Usage Examples

Validating a Layout Config

import { validateLayoutConfig } from '@ouas/validator';
import type { Manifest, LayoutConfig } from '@ouas/validator';

const manifest: Manifest = {
  ouas_version: "1.0.0",
  app_id: "com.example.app",
  app_name: "My App",
  generated_at: new Date().toISOString(),
  components: [
    {
      id: "email-row",
      display_name: "Email Row",
      category: "list",
      data_source: "emails",
      fields: {
        sender: { type: "string", required: true },
        subject: { type: "string", required: false }
      },
      variants: ["comfortable"],
      slots: []
    }
  ],
  data_sources: [],
  constraints: {}
};

const badConfig: LayoutConfig = {
  ouas_version: "1.0.0",
  config_id: "cfg-001",
  app_id: "com.example.app",
  user_id: "user-123",
  created_at: new Date().toISOString(),
  layout: {
    type: "single-column",
    regions: [
      {
        id: "main",
        component: "email-row",
        variant: "comfortable",
        visible_fields: ["subject"] // ERROR: Missing required 'sender' field!
      }
    ]
  }
};

const result = validateLayoutConfig(badConfig, manifest);

if (!result.valid) {
  console.error("Validation failed with errors:", result.errors);
  /* Output:
     [{
       code: "REQUIRED_FIELD_HIDDEN",
       message: "Required field 'sender' of component 'email-row' is not visible in region 'main'.",
       field: "sender"
     }]
  */
}

Checking Config String Sizes

import { checkConfigSizeLimits } from '@ouas/validator';

const rawJsonString = JSON.stringify(config);
const sizeErrors = checkConfigSizeLimits(rawJsonString);

if (sizeErrors.length > 0) {
  console.warn("Payload size validation failed:", sizeErrors);
}

License

MIT © OUAS Team