Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Orval is a powerful tool for generating API clients from OpenAPI (Swagger) specifications. It helps streamline the process of creating and maintaining API clients by automating the generation of TypeScript or JavaScript code based on your API definitions.
Generate API Clients
This feature allows you to generate API clients from an OpenAPI specification file. You can specify the input file, output directory, and the HTTP client library (e.g., axios) to use.
const orval = require('orval');
orval.generate({
input: './path/to/openapi.yaml',
output: './path/to/output',
client: 'axios'
});
Custom Templates
Orval supports custom templates, allowing you to tailor the generated code to your specific needs. You can provide a path to your custom templates directory.
const orval = require('orval');
orval.generate({
input: './path/to/openapi.yaml',
output: './path/to/output',
client: 'axios',
templates: './path/to/custom/templates'
});
Mock Server
Orval can generate a mock server based on your OpenAPI specification. This is useful for testing and development purposes. You can specify the input file, output directory, and the port for the mock server.
const orval = require('orval');
orval.mock({
input: './path/to/openapi.yaml',
output: './path/to/output',
port: 3000
});
Swagger-js is a JavaScript library that allows you to interact with Swagger/OpenAPI documents. It provides tools for parsing and generating API clients, but it is less focused on TypeScript support and customization compared to Orval.
OpenAPI Generator is a comprehensive tool that supports generating API clients, server stubs, and API documentation from OpenAPI specifications. It offers a wide range of language and framework support, making it more versatile but also more complex to configure than Orval.
Swagger Codegen is another tool for generating API clients, server stubs, and API documentation from Swagger/OpenAPI definitions. It is similar to OpenAPI Generator but has a different set of templates and community support. Orval is more focused on TypeScript and modern JavaScript ecosystems.
orval
is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml
or json
formats.
Generate
, valid
, cache
and mock
in your React, Vue, Svelte and Angular applications all with your OpenAPI specification.
You can find below some samples
FAQs
A swagger client generator for typescript
The npm package orval receives a total of 203,279 weekly downloads. As such, orval popularity was classified as popular.
We found that orval demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.