Socket
Socket
Sign inDemoInstall

graphql-schemax

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-schemax - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.0.5](https://github.com/nicolasdao/graphql-schemax/compare/v0.0.4...v0.0.5) (2021-10-21)
### Features
* Add constructor support for array of inline schema definitions ([23976ce](https://github.com/nicolasdao/graphql-schemax/commit/23976ce9999d705131297c97988ff2bcefa8d041))
### [0.0.4](https://github.com/nicolasdao/graphql-schemax/compare/v0.0.3...v0.0.4) (2021-10-21)

@@ -7,0 +14,0 @@

2

package.json
{
"name": "graphql-schemax",
"version": "0.0.4",
"version": "0.0.5",
"description": "Creates GraphQL string schema from plain JSON objects.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -7,3 +7,3 @@ # GRAPHQL-SCHEMAX

- Inspection: Easily traverse the schema tree.
- Leaner: Define GraphQL types, enums and inputs on-the-fly instead of having to define them explicitly.
- Leaner: Define GraphQL types, enums and inputs on-the-fly (_anonymous types_) instead of having to define them explicitly.

@@ -433,9 +433,109 @@ This package works with both ES6 modules and CommonJS and contains no dependencies.

# Manipulating schemas
## Merging schemas
# APIs
## `constructor`
The `Schemax` class supports an undefined amount of arguments. It supports an inline schema definitions as well as arrays of inline schema definitions.
__*Inline schema definitions*__
```js
import { Schemax } from 'graphql-schemax'
const schema = new Schemax(
'type Project', {
id: 'ID',
name: 'String'
},
'type User', {
id: 'ID',
first_name: 'String',
last_name: 'String'
},
'type Query', {
projects: '[Project]',
users: '[User]'
}
)
console.log(schema.toString())
```
Which can also be written as follow:
```js
import { Schemax } from 'graphql-schemax'
const inlineSchema = [
'type Project', {
id: 'ID',
name: 'String'
},
'type User', {
id: 'ID',
first_name: 'String',
last_name: 'String'
},
'type Query', {
projects: '[Project]',
users: '[User]'
}]
const schema = new Schemax(...inlineSchema)
console.log(schema.toString())
```
__*Array schema definitions*__
```js
import { Schemax } from 'graphql-schemax'
const inlineSchema = [
'type Project', {
id: 'ID',
name: 'String'
},
'type User', {
id: 'ID',
first_name: 'String',
last_name: 'String'
},
'type Query', {
projects: '[Project]',
users: '[User]'
}]
const schema = new Schemax(inlineSchema)
console.log(schema.toString())
```
or
```js
import { Schemax } from 'graphql-schemax'
const inlineSchema = [
'type Project', {
id: 'ID',
name: 'String'
},
'type User', {
id: 'ID',
first_name: 'String',
last_name: 'String'
},
'type Query', {
projects: '[Project]',
users: '[User]'
}]
const schema = new Schemax(inlineSchema)
console.log(schema.toString())
```
# FAQ
## How to merge schemas?
# Dev

@@ -442,0 +542,0 @@ ## About this project

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc