Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Marcus <marcus.mailer@twobulls.com>
- Loading branch information
1 parent
edf9d3a
commit ac172d8
Showing
14 changed files
with
154 additions
and
28 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 |
---|---|---|
|
@@ -3,6 +3,8 @@ coverage/ | |
dist/ | ||
node_modules/ | ||
!auto.config.ts | ||
/.idea/ | ||
|
||
# local config for auto | ||
.env | ||
|
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,6 @@ | ||
import ts from "typescript"; | ||
import { Annotations } from "../Type/AnnotatedType"; | ||
|
||
export interface AnnotationsReader { | ||
getAnnotations(node: ts.Node): Annotations | undefined; | ||
} |
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,5 @@ | ||
import { SubNodeParser } from "./SubNodeParser"; | ||
|
||
export interface MutableParser { | ||
addNodeParser(parser: SubNodeParser): MutableParser; | ||
} |
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,5 @@ | ||
import { SubTypeFormatter } from "./SubTypeFormatter"; | ||
|
||
export interface MutableTypeFormatter { | ||
addTypeFormatter(formatter: SubTypeFormatter): MutableTypeFormatter; | ||
} |
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,6 @@ | ||
import ts from "typescript"; | ||
import { NodeParser } from "../NodeParser"; | ||
|
||
export interface SubNodeParser extends NodeParser { | ||
supportsNode(node: ts.Node): boolean; | ||
} |
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,6 @@ | ||
import { BaseType } from "../Type/BaseType"; | ||
import { TypeFormatter } from "./TypeFormatter"; | ||
|
||
export interface SubTypeFormatter extends TypeFormatter { | ||
supportsType(type: BaseType): boolean; | ||
} |
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,7 @@ | ||
import { Definition } from "../Schema/Definition"; | ||
import { BaseType } from "../Type/BaseType"; | ||
|
||
export interface TypeFormatter { | ||
getDefinition(type: BaseType): Definition; | ||
getChildren(type: BaseType): BaseType[]; | ||
} |
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,32 @@ | ||
import { assertValidSchema } from "./utils"; | ||
|
||
describe("valid-data-annotations", () => { | ||
it( | ||
"annotation-custom", | ||
assertValidSchema("annotation-custom", "MyObject", "basic", [ | ||
"customNumberProperty", | ||
"customStringProperty", | ||
"customComplexProperty", | ||
"customMultilineProperty", | ||
"customUnquotedProperty", | ||
]) | ||
); | ||
|
||
it("annotation-empty-basic", assertValidSchema("annotation-empty", "MyObject", "basic", ["customEmptyAnnotation"])); | ||
it( | ||
"annotation-empty-extended", | ||
assertValidSchema("annotation-empty", "MyObject", "extended", ["customEmptyAnnotation"]) | ||
); | ||
it( | ||
"annotation-deprecated-empty-basic", | ||
assertValidSchema("annotation-deprecated-empty", "MyObject", "basic", ["customEmptyAnnotation"]) | ||
); | ||
it( | ||
"annotation-deprecated-empty-extended", | ||
assertValidSchema("annotation-deprecated-empty", "MyObject", "extended", ["customEmptyAnnotation"]) | ||
); | ||
|
||
it("annotation-comment", assertValidSchema("annotation-comment", "MyObject", "extended")); | ||
|
||
it("annotation-id", assertValidSchema("annotation-id", "MyObject", "extended", [], "Test")); | ||
}); |
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,15 @@ | ||
/** | ||
* @comment Top level comment | ||
*/ | ||
export interface MyObject { | ||
/** | ||
* @comment Property comment | ||
*/ | ||
nested: MyNestedObject | ||
} | ||
|
||
/** | ||
* @comment Nested object comment | ||
*/ | ||
export interface MyNestedObject {} | ||
|
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,25 @@ | ||
{ | ||
"$ref": "#/definitions/MyObject", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyNestedObject": { | ||
"$comment": "Nested object comment", | ||
"additionalProperties": false, | ||
"type": "object" | ||
}, | ||
"MyObject": { | ||
"$comment": "Top level comment", | ||
"additionalProperties": false, | ||
"properties": { | ||
"nested": { | ||
"$comment": "Property comment", | ||
"$ref": "#/definitions/MyNestedObject" | ||
} | ||
}, | ||
"required": [ | ||
"nested" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
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,11 @@ | ||
/** | ||
* @id #MyObject | ||
*/ | ||
export interface MyObject { | ||
nested: MyNestedObject | ||
} | ||
|
||
/** | ||
* @id #MyNestedObject | ||
*/ | ||
export interface MyNestedObject {} |
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,25 @@ | ||
{ | ||
"$id": "Test", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "#/definitions/MyObject", | ||
"definitions": { | ||
"MyNestedObject": { | ||
"$id": "#MyNestedObject", | ||
"additionalProperties": false, | ||
"type": "object" | ||
}, | ||
"MyObject": { | ||
"$id": "#MyObject", | ||
"additionalProperties": false, | ||
"properties": { | ||
"nested": { | ||
"$ref": "#/definitions/MyNestedObject" | ||
} | ||
}, | ||
"required": [ | ||
"nested" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |