Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-path-templating

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-path-templating - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

cjs/predicates.cjs

8

package.json
{
"name": "openapi-path-templating",
"version": "2.0.2",
"description": "OpenAPI Path Templating parser, validator and resolver.",
"version": "2.1.0",
"description": "OpenAPI Path Templating parser, validator, resolver and matcher.",
"main": "./cjs/index.cjs",

@@ -44,3 +44,5 @@ "types": "./types/index.d.ts",

"validator",
"resolver"
"resolver",
"matcher",
"matching"
],

@@ -47,0 +49,0 @@ "author": "Vladimír Gorej <vladimir.gorej@gmail.com>",

@@ -14,3 +14,3 @@ # openapi-path-templating

`openapi-path-templating` is a **parser**, **validator**, and **resolver** for OpenAPI Path Templating,
`openapi-path-templating` is a **parser**, **validator**, **resolver** and **matcher** for OpenAPI Path Templating,
which played a [foundational role](https://github.com/OAI/OpenAPI-Specification/pull/4244) in defining the official ANBF grammar for OpenAPI Path Templating.

@@ -51,2 +51,3 @@

- [Resolution](#resolution)
- [Matching](#matching)
- [Grammar](#grammar)

@@ -69,3 +70,3 @@ - [More about OpenAPI Path Templating](#more-about-openapi-path-templating)

`openapi-path-templating` currently supports **parsing**, **validation** and **resolution**.
`openapi-path-templating` currently supports **parsing**, **validation**, **resolution** and **matching**.
Both parser and validator are based on a superset of [ABNF](https://www.rfc-editor.org/rfc/rfc5234) ([SABNF](https://github.com/ldthomas/apg-js2/blob/master/SABNF.md))

@@ -219,2 +220,23 @@ and use [apg-lite](https://github.com/ldthomas/apg-lite) parser generator.

#### Matching
Path templating matching in OpenAPI prioritizes concrete paths over parameterized ones,
treats paths with identical structures but different parameter names as invalid,
and considers paths with overlapping patterns that could match the same request as potentially ambiguous.
##### Predicates
`isIdentical`
Determines whether two path templates are structurally identical, meaning they have the same sequence
of literals and template expressions, regardless of template expression names. In the OpenAPI context,
such identical paths are considered invalid due to potential conflicts in routing.
```js
import { isIdentical } from 'openapi-path-templating';
isIdentical('/pets/{petId}', '/pets/{name}'); // => true
isIdentical('/pets/{petId}', '/animals/{name}'); // => false
```
#### Grammar

@@ -221,0 +243,0 @@

@@ -54,1 +54,2 @@

export function Grammar(): Grammar;
export function isIdentical(pathTemplate1: string, pathTemplate2: string): boolean;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc