# openapi-utils-path-for-uri

> Get an openapi path for an URI

Latest version **0.0.9** (published 2018-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install openapi-utils-path-for-uri
pnpm add openapi-utils-path-for-uri
yarn add openapi-utils-path-for-uri
bun add openapi-utils-path-for-uri
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2018-04-24 |
| First published | 2016-11-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ronald Luitwieler |
| Maintainers | robodo |
| Keywords | openapi, path, uri |

## Links

- npm: https://www.npmjs.com/package/openapi-utils-path-for-uri
- Repository: https://github.com/orangewise/openapi-utils-path-for-uri
- Homepage: https://github.com/orangewise/openapi-utils-path-for-uri#readme
- Issues: https://github.com/orangewise/openapi-utils-path-for-uri/issues
- npm.io page: https://npm.io/package/openapi-utils-path-for-uri

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.9 (latest) — 2018-04-24
- 0.0.8 — 2017-06-12
- 0.0.7 — 2017-03-14
- 0.0.6 — 2016-11-25
- 0.0.5 — 2016-11-12
- 0.0.4 — 2016-11-07
- 0.0.3 — 2016-11-06
- 0.0.2 — 2016-11-06
- 0.0.1 — 2016-11-06

## README

# openapi-utils-path-for-uri

[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

Get an openApi path for an URI.

# Installation

```
npm install --save openapi-utils-path-for-uri
```

# Usage

Given the following openApi definition:

```
{
  "paths": {
    "/animals/cats": {
      "get": { }
    },
    "/animals/{species}/cats": {
      "get": { }
    },
    "/animals/{species}/dogs": {
      "get": { }
    },
    "/animals/{species}/dogs/{breed}": {
      "get": { }
    }
  }
}
```

You can retrieve the paths like this:

```javascript
var api = require('./your-openapi.json')
var openApiUtils = require('openapi-utils-path-for-uri')

var openApiPath1 = openApiUtils.pathForUri(api, '/animals/mammal/cats')
console.log(openApiPath1)
/*
/animals/{species}/cats
*/

var openApiPath2 = openApiUtils.pathForUri(api, '/animals/mammal/dogs/terrier')
console.log(openApiPath2)
/*
/animals/{species}/dogs/{breed}
*/

var openApiPath3 = openApiUtils.pathForUri(api, '/animals/cats')
console.log(openApiPath3)
/*
/animals/cats
*/


```


[npm-badge]: https://badge.fury.io/js/openapi-utils-path-for-uri.svg
[npm-url]: https://badge.fury.io/js/openapi-utils-path-for-uri
[travis-badge]: https://travis-ci.org/orangewise/openapi-utils-path-for-uri.svg?branch=master
[travis-url]: https://travis-ci.org/orangewise/openapi-utils-path-for-uri

---
_Source: https://npm.io/package/openapi-utils-path-for-uri · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
