How to use the @netlify/open-api.paths function in @netlify/open-api

To help you get started, we’ve selected a few @netlify/open-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netlify / js-client / src / open-api / shape-swagger.js View on Github external
const dfn = require('@netlify/open-api')

const { sortParams, mergeParams } = require('./util')
const methods = []

Object.entries(dfn.paths).forEach(([apiPath, verbs]) => {
  const topParams = sortParams(verbs.parameters)
  delete verbs.parameters

  Object.entries(verbs).forEach(([verb, props]) => {
    const verbParams = sortParams(props.parameters)
    delete props.parameters

    const opSpec = Object.assign(
      {},
      props,
      {
        verb,
        path: apiPath
      },
      {
        parameters: mergeParams(topParams, verbParams)

@netlify/open-api

Netlify's open-api definition as a module

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis