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

get-openapi-examples

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-openapi-examples

Extract all possible paths present in openapi.yaml based on paths and the provided examples

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

get-openapi-examples

Extract all possible paths present in openapi.yaml based on paths and the provided examples

This might be useful, for example, for testing routes. It supports different types of examples, and variables may be in the path or in the query.

If you have a openapi.yaml file like this one, for example:

paths:
  /coordinates:
    get:
      operationId: getDataByCoordinates
      summary: Get data by Coordinates in query
      parameters:
        - in: query
          name: lat
          schema:
            type: string
            example: '40.153687'
          description: Latitude of the point
        - in: query
          name: lon
          schema:
            type: string
            example: '-8.514602'
          description: Longitude of the point

  /district/{district}:
    get:
      operationId: getDistrict
      summary: Data of Distrito
      parameters:
        - in: path
          name: district
          required: true
          schema:
            type: string
          examples:
            porto:
              value: Porto
              summary: District of Porto
            lisbon:
              value: Lisbon
              summary: District of Lisbon

  /district/{district}/altimetry:
    get:
      operationId: getDistrictAltimetry
      summary: Altimetry of Distrito
      parameters:
        - in: path
          name: district
          required: true
          schema:
            type: string
            example: Porto

Then:

const getOpenapiExamples = require('get-openapi-examples')
console.log(getOpenapiExamples('/path/to/openapi.yaml'))
/*
[
  '/coordinates?lat=40.153687&lon=-8.514602',
  '/district/Porto',
  '/district/Lisbon',
  '/district/Porto/altimetry'
}
*/

Keywords

FAQs

Package last updated on 22 May 2024

Did you know?

Socket

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.

Install

Related posts

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