# graphql-apollo-json-to-schema

> recursively converts a JSON object to a Schema

Latest version **1.0.0** (published 2017-10-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install graphql-apollo-json-to-schema
pnpm add graphql-apollo-json-to-schema
yarn add graphql-apollo-json-to-schema
bun add graphql-apollo-json-to-schema
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-10-25 |
| First published | 2017-10-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | jaywalk |

## Links

- npm: https://www.npmjs.com/package/graphql-apollo-json-to-schema
- Repository: https://github.com/jaywalklabs/graphql-apollo-json-to-schema
- Homepage: https://github.com/jaywalklabs/graphql-apollo-json-to-schema#readme
- Issues: https://github.com/jaywalklabs/graphql-apollo-json-to-schema/issues
- npm.io page: https://npm.io/package/graphql-apollo-json-to-schema

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [typeof](https://npm.io/package/typeof.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2017-10-25

## README

# graphql-apollo-json-to-schema
recursively converts a JSON object to an Apollo Schema
read more about schemas [here](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html)

can be used directly with output from MongoDB

usage:

```javascript
paramters: name (String)
JSON: Json Object,
skip: array *Optional


converter(name, JSON, skip)

```

example:

```javascript

const converter = require('graphql-apollo-json-to-schema')

const input = {
  name:'Dr Steve Brule',
  profession:'Doctor',
  quotes: ['Bringo!','Jackprot!'],
  age:27,
  password:'nohunks',
  apperances: {
    checkItOut: {
      type:'tv show',
      rating:'11/10',
      date: new Date()
    },
  }
}

console.log(converter('User', input, ['password']))
//`
// OutOput:
// type User {
//   name: String
//   profession: String
//   quotes: [String]
//   age: Int
//    apperances: UserApperances
//  }
//
//  type UserApperances {
//    checkItOut: UserApperancesCheckitout
//  }
//
//  type UserApperancesCheckitout {
//   type: String
//   rating: String
//   date: String
//  }
// `

```

**Note on Arrays containing Objects:**
The first item in an array will be picked and used, if subsequent items contains other items they will be lost.

---
_Source: https://npm.io/package/graphql-apollo-json-to-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
