2.0.0 • Published 4 years ago

@cuterajat26/graphql-json-schema v2.0.0

Weekly downloads
56
License
ISC
Repository
-
Last release
4 years ago

Install

npm install @cuterajat26/graphql-json-schema --save

Usage

const graphql = require("graphql");
import { schemaConfigBuilder } from '@cuterajat26/graphql-json-schema';
const schemaConfigBuilder = require("@cuterajat26/graphql-json-schema").schemaConfigBuilder;

let schemaConfig = schemaConfigBuilder(require.resolve('./relative-path-to-config-dir/config.json'));
let schema = new graphql.GraphQLSchema(schemaConfig);

Config.json format

{
    "dependencies": [
        {
            "name": "query_operation_1",
            "path": "./query_operation_1.json",
            "type": "Query"
        },
        {
            "name": "mutation_operation_1",
            "path": "./gql/mutation_operation_1.json",
            "type": "Mutation"
        }
    ]
    }
        

Operation json format

Example query_operation_1.json

{
    "request": {
        "type": "object",
        "properties": {
            "example_boolean_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "boolean"
            },
            "example_float_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "float"
            },
            
            "example_string_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "string"
            }
            
        },        
        "description": "lorem ipsum detor laga tiki taka"
    },
    "response": {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
            "example_boolean_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "boolean"
            },
            "example_float_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "float"
            },
            
            "example_string_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "string"
            }
            }
        }
    }
    
}

Example mutation_operation_1.json

{
    "request": {
        "type": "object",
        "properties": {
            "example_boolean_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "boolean"
            },
            "example_float_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "float"
            },
            
            "example_string_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "string"
            }
            
        },        
        "description": "lorem ipsum detor laga tiki taka"
    },
      "response": {
        "type": "object",
        "properties": {
           "example_boolean_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "boolean"
            },
            "example_float_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "float"
            },
            
            "example_string_field": {
                "description": "lorem ipsum detor laga tiki taka",
                "type": "string"
            },
            "_id":{
                "description":" newly created object _id",
                "type":"string"
            }
        }
    }
    
}
2.0.0

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago