openapi-path-templating
Advanced tools
Comparing version 2.0.2 to 2.1.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101468
29
2479
295