Gathering detailed insights and metrics for gql-typescript-generator
Gathering detailed insights and metrics for gql-typescript-generator
Gathering detailed insights and metrics for gql-typescript-generator
Gathering detailed insights and metrics for gql-typescript-generator
@graphql-codegen/core
<p align="center"> <img src="https://github.com/dotansimha/graphql-code-generator/blob/master/logo.png?raw=true" /> </p>
@graphql-codegen/cli
<p align="center"> <img src="https://github.com/dotansimha/graphql-code-generator/blob/master/logo.png?raw=true" /> </p>
gql-test-generator
Forked from graphql-codegen-typescript-validation-schema. Getting something together to generate smoke tests automatically across resolvers.
graphql-codegen-typescript-validation-schema
GraphQL Code Generator plugin to generate form validation schema from your GraphQL schema
Generate queries from graphql schema, used for writing api test.
npm install gql-typescript-generator
Typescript
Module System
Node Version
NPM Version
JavaScript (72.71%)
HTML (27.29%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2 Stars
40 Commits
2 Forks
1 Watchers
7 Branches
9 Contributors
Updated on Aug 05, 2020
Latest Version
10.0.3
Package Id
gql-typescript-generator@10.0.3
Unpacked Size
701.33 kB
Size
378.18 kB
File Count
71
NPM Version
6.14.4
Node Version
12.16.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Generate queries from graphql schema, used for writing api test.
1# Sample schema 2type Query { 3 user(id: Int!): User! 4} 5 6type User { 7 id: Int! 8 username: String! 9 email: String! 10 createdAt: String! 11}
1# Sample query generated 2query user($id: Int!) { 3 user(id: $id){ 4 id 5 username 6 email 7 createdAt 8 } 9}
1# Install 2npm install gql-generator -g 3 4# see the usage 5gqlg --help 6 7# Generate sample queries from schema file 8gqlg --schemaFilePath ./example/sampleTypeDef.graphql --destDirPath ./example/output --depthLimit 5
Now the queries generated from the sampleTypeDef.graphql
can be found in the destDir: ./example/output
.
This tool generate 3 folders holding the queries: mutations, queries and subscriptions. And also index.js
files to export the queries in each folder.
You can require the queries like this:
1// require all the queries 2const queries = require('./example/output'); 3// require mutations only 4const mutations = require('./example/output/mutations'); 5 6// sample content 7console.log(queries.mutations.signup); 8console.log(mutations.signup); 9/* 10mutation signup($username: String!, email: String!, password: String!){ 11 signup(username: $username, email: $email, password: $password){ 12 token 13 user { 14 id 15 username 16 email 17 createdAt 18 } 19 } 20} 21*/ 22
Say you have a graphql schema like this:
1type Mutation { 2 signup( 3 email: String! 4 username: String! 5 password: String! 6 ): UserToken! 7} 8 9type UserToken { 10 token: String! 11 user: User! 12} 13 14type User { 15 id: Int! 16 username: String! 17 email: String! 18 createdAt: String! 19}
Before this tool, you write graphql api test like this:
1const { GraphQLClient } = require('graphql-request'); 2require('should'); 3 4const host = 'http://localhost:8080/graphql'; 5 6test('signup', async () => { 7 const gql = new GraphQLClient(host); 8 const query = `mutation signup($username: String!, email: String!, password: String!){ 9 signup(username: $username, email: $email, password: $password){ 10 token 11 user { 12 id 13 username 14 email 15 createdAt 16 } 17 } 18 }`; 19 20 const data = await gql.request(query, { 21 username: 'tim', 22 email: 'timqian92@qq.com', 23 password: 'samplepass', 24 }); 25 26 (typeof data.signup.token).should.equal('string'); 27);
As gqlg
generated the queries for you, you don't need to write the query yourself, so your test will becomes:
1const { GraphQLClient } = require('graphql-request'); 2require('should'); 3const mutations = require('./example/output/mutations'); 4 5const host = 'http://localhost:8080/graphql'; 6 7test('signup', async () => { 8 const gql = new GraphQLClient(host); 9 10 const data = await gql.request(mutations.signup, { 11 username: 'tim', 12 email: 'timqian92@qq.com', 13 password: 'samplepass', 14 }); 15 16 (typeof data.signup.token).should.equal('string'); 17);
As this tool is used for test, it expends all the fields in a query. And as we know, there might be recursive field in the query. So gqlg
ignores the types which has been added in the parent queries already.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/15 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
49 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More