![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
swagger-fluent
Advanced tools
A fluent OpenAPI and Swagger client for JavaScript and Node.js.
fluent-client represents Path Item Object with chains of objects:
/api/v1/namespaces -> api.v1.namespaces
associates operations on a Path Item Object with functions:
/api/v1/namespaces -> api.v1.namespaces.get()
and represents Path Templating with function calls:
/api/v1/namespaces/{namespace}/pods -> api.v1.namespaces(namespace).pods
Configurable "backends" handle executing API calls by, for example,
using fetch
or Swagger
Client. A backend can also perform
error checking. The Swagger Client backend, for example, will perform
the usual parameter and resolution checking that
swagger-js performs and
will throw those errors to the caller.
const spec = require('./swagger.json')
const url = 'https://petstore.swagger.io/v2/'
const FetchBackend = require('swagger-fluent/backends/fetch')
const backend = new FetchBackend({ fetch, url })
const { Client } = require('swagger-fluent')
const client = new Client({ spec, backend })
const response = await client.pet.findByStatus.get({ parameters: { status: 'available' } })
Client(options)
Create a fluent client for an OpenAPI or Swagger specification.
options.spec
- OpenAPI or Swagger specification.options.backend
- Object with an .http
method that executes HTTP
r equests.options.getNames(name, ancestors)
- a function to translate each
path name to an alternate name or array of names. You could, for
example, alias the resource "namespaces" to "namespace" and "ns".FetchBackend(options)
Create a Fetch API-based backend.
options.fetch
- fetch
function (e.g.,
node-fetch
or
whatwg-fetch
).options.url
- Base URL for HTTP API.const FetchBackend = require('swagger-fluent/backends/fetch')
RequestBackend(options)
const RequestBackend = require('swagger-fluent/backends/request')
SwaggerClientBackend(options)
Create a swagger-js-based backend.
const SwaggetClientBackend = require('swagger-fluent/backends/swagger-client')
The backend must implement an .http
method. swagger-fluent passes
the following options to the .http
method, and returns the result
directly to the API caller.
options.body
- JSONifable object.options.method
- HTTP method.options.pathItemObject
- Swagger/OpenAPI Path Item Object.options.parameters
- named query parameters.options.qs
- named query parameters (legacy).options.pathname
- URL pathname.options.stream
- true if called by a "stream method".FAQs
A fluent client for OpenAPI and Swagger
The npm package swagger-fluent receives a total of 28,691 weekly downloads. As such, swagger-fluent popularity was classified as popular.
We found that swagger-fluent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.