Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@swagger-api/apidom-json-pointer
Advanced tools
@swagger-api/apidom-json-pointer is an npm package that provides utilities for working with JSON Pointers, which are a way to reference specific parts of a JSON document. This package is particularly useful for navigating and manipulating JSON data structures in a standardized way.
Creating JSON Pointers
This feature allows you to create a JSON Pointer instance from a string. The created pointer can then be used to reference specific parts of a JSON document.
const { JsonPointer } = require('@swagger-api/apidom-json-pointer');
const pointer = JsonPointer.create('/path/to/element');
console.log(pointer.toString()); // Outputs: /path/to/element
Resolving JSON Pointers
This feature allows you to resolve a JSON Pointer against a JSON document to retrieve the value at the specified location.
const { JsonPointer } = require('@swagger-api/apidom-json-pointer');
const document = { path: { to: { element: 'value' } } };
const pointer = JsonPointer.create('/path/to/element');
const value = pointer.resolve(document);
console.log(value); // Outputs: 'value'
Setting Values with JSON Pointers
This feature allows you to set a value at a specific location in a JSON document using a JSON Pointer.
const { JsonPointer } = require('@swagger-api/apidom-json-pointer');
const document = { path: { to: { element: 'value' } } };
const pointer = JsonPointer.create('/path/to/element');
pointer.set(document, 'newValue');
console.log(document.path.to.element); // Outputs: 'newValue'
The 'jsonpointer' package provides similar functionality for working with JSON Pointers. It allows you to get and set values in JSON documents using JSON Pointers. Compared to @swagger-api/apidom-json-pointer, 'jsonpointer' is more widely used and has a simpler API.
The 'json-ptr' package is another alternative for working with JSON Pointers. It offers a comprehensive set of features for creating, resolving, and manipulating JSON Pointers. It also includes additional utilities for working with JSON References. 'json-ptr' is more feature-rich compared to @swagger-api/apidom-json-pointer.
apidom-json-pointer
is a package that evaluates JSON Pointer against ApiDOM.
You can install this package via npm CLI by running the following command:
$ npm install @swagger-api/apidom-json-pointer
import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate } from '@swagger-api/apidom-json-pointer';
const apidom = new ObjectElement({ a: { b: 'c' } });
const result = evaluate('/a/b', apidom);
// => StringElement('c')
Parses JSON Pointer into list of tokens.
import { parse } from '@swagger-api/apidom-json-pointer';
const tokens = parse('/a/b'); // => ['a', 'b']
Compiles list of tokens into JSON Pointer.
import { compile } from '@swagger-api/apidom-json-pointer';
const jsonPointer = compile(['a', 'b']); // => '/a/b'
Escapes/unescapes tokens of JSON Pointer.
import { escape, unescape } from '@swagger-api/apidom-json-pointer';
escape('~a/'); // => '~0a~1'
unescape('~0a~1'); // => '~a/'
Handles case of URI Fragment Identifier Representation.
import { uriToPointer } from '@swagger-api/apidom-json-pointer';
uriToPointer('https://example.com/path/#/a/b'); // => '/a/b'
If invalid JSON Pointer is supplied to parse
or evaluate
functions, InvalidJsonPointerError
is thrown.
import { InvalidJsonPointerError } from '@swagger-api/apidom-json-pointer';
If valid JSON Pointer is supplied to evaluate
function and the pointer cannot be evaluated against
ApiDOM fragment, EvaluationJsonPointerError
is thrown.
import { EvaluationJsonPointerError } from '@swagger-api/apidom-json-pointer';
0.84.0 (2023-11-24)
FAQs
Evaluate JSON Pointer expressions against ApiDOM.
The npm package @swagger-api/apidom-json-pointer receives a total of 0 weekly downloads. As such, @swagger-api/apidom-json-pointer popularity was classified as not popular.
We found that @swagger-api/apidom-json-pointer 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.