Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: charlypoly/functional-json-schema
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5e309bfcff1733e387f9fb08f1b642038151a10e
Choose a base ref
...
head repository: charlypoly/functional-json-schema
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.0
Choose a head ref

Commits on May 31, 2018

  1. Merge pull request #1 from wittydeveloper/v1

    v1 release
    Charly POLY authored May 31, 2018
    Copy the full SHA
    18cf9c5 View commit details

Commits on Jan 11, 2021

  1. build(deps): bump lodash from 4.17.10 to 4.17.19

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.10 to 4.17.19.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.10...4.17.19)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 11, 2021
    Copy the full SHA
    c7395dc View commit details
  2. Copy the full SHA
    f743bd0 View commit details

Commits on Jan 12, 2021

  1. Copy the full SHA
    81f48b5 View commit details
  2. Merge pull request #5 from wittydeveloper/dependabot/npm_and_yarn/lod…

    …ash-4.17.19
    
    build(deps): bump lodash from 4.17.10 to 4.17.19
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    a9bacdc View commit details
  3. Merge pull request #7 from wittydeveloper/dependabot/npm_and_yarn/han…

    …dlebars-4.7.6
    
    build(deps): bump handlebars from 4.0.11 to 4.7.6
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    b52ac50 View commit details
  4. build(deps): bump mixin-deep from 1.3.1 to 1.3.2

    Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
    - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
    - [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    7a8f126 View commit details
  5. build(deps): bump ini from 1.3.5 to 1.3.8

    Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
    - [Release notes](https://github.com/isaacs/ini/releases)
    - [Commits](npm/ini@v1.3.5...v1.3.8)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    db65bb9 View commit details
  6. Copy the full SHA
    2da0e50 View commit details
  7. Merge pull request #6 from wittydeveloper/dependabot/npm_and_yarn/ini…

    …-1.3.8
    
    build(deps): bump ini from 1.3.5 to 1.3.8
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    15e59bf View commit details
  8. Merge pull request #8 from wittydeveloper/dependabot/npm_and_yarn/sta…

    …ndard-version-8.0.1
    
    build(deps-dev): bump standard-version from 4.3.0 to 8.0.1
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    17642f9 View commit details
  9. build(deps): bump merge from 1.2.0 to 1.2.1

    Bumps [merge](https://github.com/yeikos/js.merge) from 1.2.0 to 1.2.1.
    - [Release notes](https://github.com/yeikos/js.merge/releases)
    - [Commits](swordev/merge@v1.2.0...v1.2.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    593cb7a View commit details
  10. build(deps): bump lodash.template from 4.4.0 to 4.5.0

    Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.4.0...4.5.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    a8a723a View commit details
  11. Merge pull request #10 from wittydeveloper/dependabot/npm_and_yarn/mi…

    …xin-deep-1.3.2
    
    build(deps): bump mixin-deep from 1.3.1 to 1.3.2
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    d113ecc View commit details
  12. build(deps): bump acorn from 5.5.3 to 5.7.4

    Bumps [acorn](https://github.com/acornjs/acorn) from 5.5.3 to 5.7.4.
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@5.5.3...5.7.4)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    d84b13a View commit details
  13. build(deps): bump js-yaml from 3.11.0 to 3.14.1

    Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.11.0 to 3.14.1.
    - [Release notes](https://github.com/nodeca/js-yaml/releases)
    - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
    - [Commits](nodeca/js-yaml@3.11.0...3.14.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    edc0732 View commit details
  14. Merge pull request #14 from wittydeveloper/dependabot/npm_and_yarn/me…

    …rge-1.2.1
    
    build(deps): bump merge from 1.2.0 to 1.2.1
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    fad5474 View commit details
  15. build(deps): bump extend from 3.0.1 to 3.0.2

    Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2.
    - [Release notes](https://github.com/justmoon/node-extend/releases)
    - [Changelog](https://github.com/justmoon/node-extend/blob/main/CHANGELOG.md)
    - [Commits](justmoon/node-extend@v3.0.1...v3.0.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 12, 2021
    Copy the full SHA
    4a6a890 View commit details
  16. Merge pull request #15 from wittydeveloper/dependabot/npm_and_yarn/lo…

    …dash.template-4.5.0
    
    build(deps): bump lodash.template from 4.4.0 to 4.5.0
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    9fef6f6 View commit details
  17. Merge pull request #13 from wittydeveloper/dependabot/npm_and_yarn/ex…

    …tend-3.0.2
    
    build(deps): bump extend from 3.0.1 to 3.0.2
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    73c3404 View commit details
  18. Merge pull request #12 from wittydeveloper/dependabot/npm_and_yarn/ac…

    …orn-5.7.4
    
    build(deps): bump acorn from 5.5.3 to 5.7.4
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    0e89892 View commit details
  19. Merge pull request #11 from wittydeveloper/dependabot/npm_and_yarn/js…

    …-yaml-3.14.1
    
    build(deps): bump js-yaml from 3.11.0 to 3.14.1
    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    a035282 View commit details
  20. Create codeql-analysis.yml

    Charly POLY authored Jan 12, 2021
    Copy the full SHA
    f4a7344 View commit details

Commits on Jan 13, 2021

  1. Merge pull request #9 from wittydeveloper/feat/definition-api

    feat(dsl): add schema.definition() API
    Charly POLY authored Jan 13, 2021
    Copy the full SHA
    7b8fcd5 View commit details
  2. Copy the full SHA
    6e653dd View commit details
  3. Merge pull request #17 from wittydeveloper/feat/schema-definitions-im…

    …provements
    
    feat(dsl): add better API for definitions with schema()
    Charly POLY authored Jan 13, 2021
    Copy the full SHA
    c252c2b View commit details
  4. chore(release): 1.0.0

    charlypoly committed Jan 13, 2021
    Copy the full SHA
    3b114a2 View commit details
Showing with 7,995 additions and 495 deletions.
  1. +67 −0 .github/workflows/codeql-analysis.yml
  2. +16 −1 CHANGELOG.md
  3. +131 −6 README.md
  4. +153 −46 __tests__/e2e.tsx
  5. +1 −1 __tests__/tests.tsx
  6. +214 −101 lib/index.ts
  7. +6,703 −0 package-lock.json
  8. +4 −3 package.json
  9. +2 −2 tsconfig.json
  10. +704 −335 yarn.lock
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '21 8 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## 1.0.0 (2021-01-13)


### Features

* **dsl:** add better API for definitions with schema() ([6e653dd](https://github.com/wittydeveloper/functional-json-schema/commit/6e653dd27cfc788871f5da9351ce6dd89aa89979))
* **dsl:** add schema.definition() API ([81f48b5](https://github.com/wittydeveloper/functional-json-schema/commit/81f48b5faa0ee7ef749d3f5c32f7e89b114505c6))
* **lib:** initial draft ([a2c704d](https://github.com/wittydeveloper/functional-json-schema/commit/a2c704ddd1cc6aed35ab664a8b330f11f749c4e1))


### Bug Fixes

* **lib:** enum ([8a8339a](https://github.com/wittydeveloper/functional-json-schema/commit/8a8339aa7bc81a65f330b1e01a6d84a9954f6fd7))
* **lib:** minor fixes ([2f6625e](https://github.com/wittydeveloper/functional-json-schema/commit/2f6625e644f4e4e7306feeb0848aa9d523688fcf))

<a name="0.0.2-3"></a>
## [0.0.2-3](https://github.com/wittydeveloper/functional-json-schema/compare/v0.0.2-2...v0.0.2-3) (2018-05-31)

137 changes: 131 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,22 +3,23 @@ Build a JSON Schema with functions



**target API for 1.0**
## Schema DSL

### Simple schema

```js

import * as schema from 'functional-json-schema';

const JSONschema = schema.schema({
person: {
friends: schema.types.arrayOf(schema.types.definition('user')),
const JsonSchema = schema.schema({
person: {
friends: schema.types.arrayOf(schema.types.definition('user')),
id: 'string*',
friend_ids: schema.types.arrayOf(schema.types.definition('User'), { required: true }),
}
}, null, { schema: 'http://json-schema.org/draft-06/schema#' })

/*
=> {
$schema: 'http://json-schema.org/draft-06/schema#',
type: 'object',
@@ -29,7 +30,7 @@ const JSONschema = schema.schema({
friends: {
"type": "array",
"items": {
"$ref": "#/definitions/User"
"$ref": "#/definitions/User"
}
},
(...)
@@ -40,3 +41,127 @@ const JSONschema = schema.schema({
}
*/
```
### Schema with definitions

```js

import * as schema from 'functional-json-schema';

const schemaWithDefinitions = schema(
{
community_list: {
portfolio_ids: types.arrayOf("string", { required: true }),
project_id: types.type("string", { required: true }),
status: types.enumOf("active", "inactive"),
user: types.anyOf(types.definition("User"), types.definition("Admin")),
},
}, {
User: {
firstName: types.type("string"),
lastName: types.type("string"),
jobTitle: types.type("string"),
companyId: types.type("string"),
},
},
{ schema: 'http://json-schema.org/draft-06/schema#' }
);

/*
=> {
$schema: 'http://json-schema.org/draft-06/schema#',
type: "object",
properties: {
community_list: {
type: "object",
properties: {
portfolio_ids: {
type: "array",
items: {
type: "string",
},
},
project_id: {
type: "string",
},
user: {
anyOf: [
{ $ref: "#/definitions/User" },
{ $ref: "#/definitions/Admin" },
],
},
status: {
enum: ["active", "inactive"],
},
},
required: ["portfolio_ids", "project_id"],
},
},
definitions: {
User: {
type: "object",
properties: {
firstName: {
type: "string",
},
lastName: {
type: "string",
},
jobTitle: {
type: "string",
},
companyId: {
type: "string",
},
},
required: [],
},
}
}
*/
```

## standalone definition DSL

```js

import * as schema from 'functional-json-schema';

const JsonSchemaDefinition = schema.definition(
'User',
{
firstName: schema.types.type('string'),
lastName: schema.types.type('string'),
jobTitle: schema.types.type('string'),
companyId: schema.types.type('string'),
},
{ title: "User", description: "Fake User Object" }
)

/*
=> {
"$ref": "#/definitions/User",
"definitions": {
"User": {
"type": "object",
"title": "User",
"description": "Fake User Object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"jobTitle": {
"type": "string"
},
"companyId": {
"type": "string"
}
},
required: [],
}
}
}
*/
```
Loading