-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(jex): move around a bunch of files and rename functions (#429)
- Loading branch information
1 parent
74c3214
commit a502f8f
Showing
19 changed files
with
69 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
import { JexError } from './errors' | ||
import * as jex from './jex-representation' | ||
import * as jexir from './jexir' | ||
import { JSONSchema7 } from 'json-schema' | ||
|
||
import { jexEquals } from './jex-equals' | ||
import { jexExtends, JexExtensionResult } from './jex-extends' | ||
import { jexMerge } from './jex-merge' | ||
|
||
export * as errors from './errors' | ||
|
||
export type JSONSchema = JSONSchema7 | ||
|
||
export const jsonSchemaEquals = async (a: JSONSchema, b: JSONSchema): Promise<boolean> => { | ||
const jexA = await jex.toJex(a) | ||
const jexB = await jex.toJex(b) | ||
return jex.jexEquals(jexA, jexB) | ||
const jexA = await jexir.fromJsonSchema(a) | ||
const jexB = await jexir.fromJsonSchema(b) | ||
return jexEquals(jexA, jexB) | ||
} | ||
|
||
export const jsonSchemaExtends = async (a: JSONSchema, b: JSONSchema): Promise<jex.JexExtensionResult> => { | ||
const jexA = await jex.toJex(a) | ||
const jexB = await jex.toJex(b) | ||
return jex.jexExtends(jexA, jexB) | ||
export const jsonSchemaExtends = async (a: JSONSchema, b: JSONSchema): Promise<JexExtensionResult> => { | ||
const jexA = await jexir.fromJsonSchema(a) | ||
const jexB = await jexir.fromJsonSchema(b) | ||
return jexExtends(jexA, jexB) | ||
} | ||
|
||
export const jsonSchemaMerge = async (a: JSONSchema, b: JSONSchema): Promise<JSONSchema> => { | ||
const jexA = await jex.toJex(a) | ||
const jexB = await jex.toJex(b) | ||
const jexA = await jexir.fromJsonSchema(a) | ||
const jexB = await jexir.fromJsonSchema(b) | ||
|
||
if (jexA.type !== 'object' || jexB.type !== 'object') { | ||
throw new JexError('Both schemas must be objects to be merged') | ||
} | ||
|
||
const mergedJex = jex.jexMerge(jexA, jexB) | ||
return jex.fromJex(mergedJex) | ||
const mergedJex = jexMerge(jexA, jexB) | ||
return jexir.toJsonSchema(mergedJex) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
jex/src/jex-representation/jex-equals.ts → jex/src/jex-equals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
...rc/jex-representation/jex-extends.test.ts → jex/src/jex-extends.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
jex/src/jex-representation/jex-merge.ts → jex/src/jex-merge.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './typings' | ||
export * from './from-json-schema' | ||
export * from './to-json-schema' | ||
export * from './to-string' |
6 changes: 3 additions & 3 deletions
6
jex/src/jex-representation/from-jex.test.ts → jex/src/jexir/to-json-schema.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jex/src/jex-representation/to-string.test.ts → jex/src/jexir/to-string.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
jex/src/jex-representation/typings.ts → jex/src/jexir/typings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.