
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
@codama/validators
Advanced tools
This package offers a set of validation rules for Codama IDLs to ensure that they are correctly formatted.
pnpm install @codama/validators
[!NOTE] This package is included in the main
codama
package. Meaning, you already have access to its content if you are installing Codama this way.pnpm install codama
ValidationItem
A validation item describes a single piece of information — typically a warning or an error — about a node in the Codama IDL.
type ValidationItem = {
// The level of importance of a validation item.
level: 'debug' | 'trace' | 'info' | 'warn' | 'error';
// A human-readable message describing the issue or information.
message: string;
// The node that the validation item is related to.
node: Node;
// The path of nodes that led to the node above (including the node itself).
path: NodePath;
};
getValidationItemsVisitor(visitor)
The getValidationItemsVisitor
function returns a visitor that collects all validation items from a Codama IDL. Note that this visitor is still a work in progress and does not cover all validation rules.
import { getValidationItemsVisitor } from '@codama/validators';
const validationItems = codama.accept(getValidationItemsVisitor());
throwValidatorItemsVisitor(visitor)
The throwValidatorItemsVisitor
function accepts a Visitor<ValidationItemp[]>
and throws an error if any validation items above a certain level are found. By default, the level is set to 'error'
but a second argument can be passed to change it.
import { throwValidatorItemsVisitor, getValidationItemsVisitor } from '@codama/validators';
// Throw if any "error" items are found.
codama.accept(throwValidatorItemsVisitor(getValidationItemsVisitor()));
// Throw if any "warn" or "error" items are found.
codama.accept(throwValidatorItemsVisitor(getValidationItemsVisitor(), 'warn'));
FAQs
Validator visitors for the Codama framework
The npm package @codama/validators receives a total of 711 weekly downloads. As such, @codama/validators popularity was classified as not popular.
We found that @codama/validators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.