Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
chimp-datasources-generator
Advanced tools
Helper that autogenerates DataSource-compatible APIs per controller for a given microservice, based on OpenAPI/Swagger specification
Helper that autogenerates DataSource-compatible APIs per controller for a given microservice, based on OpenAPI/Swagger specification.
You can see a real-life usage (article with a video) here: https://www.xolv.io/blog/generate-your-apollo-datasources-2/.
It's error-prone, slow and boring to create all those connectors manually. Most people either skip typing them, or type them manually (which is again error-prone, slow and boring). Having them generated makes the Developer Experience much nicer and the whole system significantly more maintainable.
Usage: chimp-datasources-generator [options]
[command]
Commands:
create <directory> <api-location> [custom-data-source-import] Create the datasources for api, pass either a URL or a yaml/json file.
Use http/https when pointing to a URL and relative location when pointing to a file
Examples:
chimp-datasources-generator create ./generated/external-apis https://domain.com/v3/api-docs.yaml
chimp-datasources-generator create ./generated/external-apis ./api-docs.yaml
You can also specify your own custom data source import:
chimp-datasources-generator create ./generated/external-apis ./api-docs.yaml "@app/apis/DataSource#DataSource" "@app/apis/DataSource#DataSource" will use an import of:
import { DataSource } from "@app/apis/DataSource"
For a default import just use the path:
"@app/apis/BaseDataSource"
In your code create dataSources.ts file like this one:
import { Controllers } from "@generated/external-apis";
export const dataSources = () => ({
todoListsApi: new Controllers("http://localhost:8090/"),
});
export type DataSources = ReturnType<typeof dataSources>;
Add the dataSources to your ApolloServer configuration
new ApolloServer({
schema,
dataSources,
});
Make sure to add the DataSources to the GqlContext type in ./src/context.ts
import { DataSources } from "@app/dataSources";
export type GqlContext = { dataSources: DataSources };
We are using the swagger-codegen-cli with custom templates and a bit of extra scripting.
FAQs
Helper that autogenerates DataSource-compatible APIs per controller for a given microservice, based on OpenAPI/Swagger specification
The npm package chimp-datasources-generator receives a total of 29 weekly downloads. As such, chimp-datasources-generator popularity was classified as not popular.
We found that chimp-datasources-generator 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.