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

@reso-standards/reso-validation

v0.1.0

Published

RESO validation library — isomorphic, no Node/browser APIs.

Readme

@reso-standards/validation

Isomorphic TypeScript validation library for RESO Data Dictionary records. Validates field types, lengths, and ranges against metadata, plus resource-specific business rules with cross-field constraints. Zero external dependencies.

User Guide – a task-oriented walkthrough with realistic examples.

Install

This package isn't on npm yet. Install from the reso-tools monorepo on GitHub:

git clone https://github.com/RESOStandards/reso-tools.git
cd reso-tools/reso-validation
npm install

This package has no sibling dependencies — npm install just runs. To bootstrap every package at once, run npm run bootstrap from the repo root instead.

To consume the SDK from another project, link it locally with npm link or use a file: dependency.

Usage

import { validateRecord, validateBusinessRules, getBusinessRules } from '@reso-standards/validation';
import type { ResoField, ValidationFailure } from '@reso-standards/validation';

// Validate a record against field metadata
const failures = validateRecord(record, fields);

// Validate resource-specific business rules
const ruleFailures = validateBusinessRules('Property', record);

// Get the rule definitions for a resource
const rules = getBusinessRules('Property');

API

validateRecord(body, fields): ValidationFailure[]

Validates a record payload against RESO field metadata. Checks:

  • Unknown fields – fields not in metadata
  • Type mismatches – Edm.String, Edm.Boolean, Edm.Int32, Edm.Decimal, Edm.Date, Edm.DateTimeOffset, etc.
  • Negative numerics – rejects negative values for numeric types
  • MaxLength – strings exceeding field.maxLength
  • Integer enforcement – Int types must be whole numbers
  • Collection fields – must be arrays
  • Enum fields – must be string or number
  • Business rules – delegates to validateBusinessRules() for range/relationship checks

Null, undefined, and empty string values are silently skipped unless the field is required. Fields starting with @ (OData annotations) are ignored.

validateBusinessRules(resourceName, body): ValidationFailure[]

Validates resource-specific constraints:

Property:

  • Required: City, StateOrProvince, PostalCode, Country
  • Price fields (> 0 to $1B): ListPrice, OriginalListPrice, PreviousListPrice, ClosePrice, ListPriceLow
  • Room counts (0 to 100): BedroomsTotal, BathroomsFull, BathroomsHalf, etc.
  • Expense/fee/amount fields ($0 to $10K): matched via fieldPattern regex /(?:Expense|Amount|Fee\d?)$/
  • Latitude and Longitude are exempt from the non-negative rule (negative coordinates are valid)
  • Cross-field: BathroomsTotalInteger = sum(BathroomsFull + BathroomsHalf + ...)

Member: Required MemberCity, MemberStateOrProvince, MemberPostalCode, MemberCountry

Office: Required OfficeCity, OfficeStateOrProvince, OfficePostalCode, OfficeCountry

getBusinessRules(resourceName): FieldRule[]

Returns the per-field constraint definitions for a resource.

Type Helpers

  • isEnumType(type) – true if type is an enum reference (not a primitive Edm type)
  • isNumericEdmType(type) – true for Edm.Decimal, Edm.Int32, Edm.Double, etc.
  • isIntegerEdmType(type) – true for Edm.Int16, Edm.Int32, Edm.Int64, Edm.Byte

Types

interface ValidationFailure {
  readonly field: string;
  readonly reason: string;
}

interface FieldRule {
  readonly fieldName: string;
  readonly fieldPattern?: RegExp;  // regex alternative to fieldName for matching multiple fields
  readonly required?: boolean;
  readonly min?: number;
  readonly max?: number;
  readonly message?: string;
}

interface CrossFieldRule {
  readonly name: string;
  readonly validate: (body: Record<string, unknown>) => ValidationFailure | null;
}

Integration

Used by both the reference server (request body validation on POST/PATCH) and the React UI (client-side form validation). Also used by @reso-standards/certification for payload validation in compliance testing.

License

See LICENSE in the repository root.