-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeSpec Definition for APIView TreeStyle Parser (#8657)
* Add TypeSpec Definition for APIView TreeStyle Parser * Update TreeStyleParser Schema * Update StructuredToken id documentation, and update json schema
- Loading branch information
1 parent
c9853b6
commit 2e2e0a6
Showing
14 changed files
with
600 additions
and
0 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/APITreeNode.json
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,97 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "APITreeNode.json", | ||
"type": "object", | ||
"properties": { | ||
"Name": { | ||
"type": "string", | ||
"description": "The name of the tree node which will be used as label for the API Navigation. Generally this is the name of the module (class, method)." | ||
}, | ||
"Id": { | ||
"$ref": "APITreeNodeId.json", | ||
"description": "Id of the node, which should be unique at the node level. i.e. unique among its siblings. This was previously represented by the DefinitionId for the main Token of the node." | ||
}, | ||
"Kind": { | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"const": "assembly" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "namespace" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "class" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "delegate" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "enum" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "interface" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "method" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "package" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "struct" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "type" | ||
} | ||
], | ||
"description": "Descriptor for the kind of the node. Currently used to select navigation icons" | ||
}, | ||
"TopTokens": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "StructuredToken.json" | ||
}, | ||
"description": "The main data of the node. This is all the tokens that actually define the node. When rendering, TopTokens are rendered first, followed by any Children, and then finally BottomTokens" | ||
}, | ||
"BottomTokens": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "StructuredToken.json" | ||
}, | ||
"description": "Tokens which are rendered after all child nodes. Depending on the language this would include the closing curly brace and/or empty lines." | ||
}, | ||
"Children": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "APITreeNode.json" | ||
}, | ||
"description": "The nodes immediate children. For a namespace this would be classes, for a class this would be the class constructors and methods. Children are rendered after TopTokens but before BottomTokens, and are automatically indented." | ||
}, | ||
"Properties": { | ||
"$ref": "APITreeNodeProperties.json", | ||
"description": "Properties of the APITreeNode." | ||
}, | ||
"Tags": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "APITreeNodeTags.json" | ||
}, | ||
"description": "Tags of the APITreeNode." | ||
} | ||
}, | ||
"required": [ | ||
"Name", | ||
"Id", | ||
"Kind" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/APITreeNodeId.json
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 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "APITreeNodeId.json", | ||
"type": "string" | ||
} |
15 changes: 15 additions & 0 deletions
15
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/APITreeNodeProperties.json
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 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "APITreeNodeProperties.json", | ||
"type": "object", | ||
"properties": { | ||
"IconName": { | ||
"type": "string", | ||
"description": "Use this only if you are looking to add a custom icon different from language wide defaults set by APITreeNode kind" | ||
}, | ||
"CrossLangDefId": { | ||
"type": "string", | ||
"description": "The cross language definitionId for the node." | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/APITreeNodeTags.json
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,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "APITreeNodeTags.json", | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"const": "Deprecated", | ||
"description": "Mark a token as deprecated." | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Hidden", | ||
"description": "Mark a node as Hidden." | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "HideFromNav", | ||
"description": "Indicate that a node should be hidden from the page navigation." | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "SkipDiff", | ||
"description": "Indicate that a node should not be used in computation of diff." | ||
} | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/CodeDiagnostic.json
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,31 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "CodeDiagnostic.json", | ||
"type": "object", | ||
"properties": { | ||
"DiagnosticId": { | ||
"type": "string", | ||
"description": "String associated with a given diagnostic usieally produced by an analyzer" | ||
}, | ||
"Text": { | ||
"type": "string" | ||
}, | ||
"HelpLinkUri": { | ||
"type": "string" | ||
}, | ||
"TargetId": { | ||
"$ref": "APITreeNodeId.json", | ||
"description": "Maps to the APITreeNode id" | ||
}, | ||
"Level": { | ||
"$ref": "CodeDiagnosticLevel.json" | ||
} | ||
}, | ||
"required": [ | ||
"DiagnosticId", | ||
"Text", | ||
"HelpLinkUri", | ||
"TargetId", | ||
"Level" | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/CodeDiagnosticLevel.json
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 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "CodeDiagnosticLevel.json", | ||
"type": "number", | ||
"enum": [ | ||
1, | ||
2, | ||
3, | ||
4 | ||
] | ||
} |
123 changes: 123 additions & 0 deletions
123
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/CodeFile.json
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,123 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "CodeFile.json", | ||
"type": "object", | ||
"properties": { | ||
"VersionString": { | ||
"type": "string", | ||
"description": "The version of the parser" | ||
}, | ||
"Name": { | ||
"type": "string", | ||
"description": "Name the ocde file. Usually just the package name and version" | ||
}, | ||
"Language": { | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"const": "C" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "C#" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "C++" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Go" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Java" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "JavaScript" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Json" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Kotlin" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Python" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Swagger" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Swift" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "TypeSpec" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Xml" | ||
} | ||
] | ||
}, | ||
"LanguageVariant": { | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"const": "Default" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Spring" | ||
}, | ||
{ | ||
"type": "string", | ||
"const": "Android" | ||
} | ||
], | ||
"default": "Default" | ||
}, | ||
"PackageName": { | ||
"type": "string" | ||
}, | ||
"ServiceName": { | ||
"type": "string" | ||
}, | ||
"PackageVersion": { | ||
"type": "string" | ||
}, | ||
"CrossLanguagePackageId": { | ||
"type": "string", | ||
"description": "Maps related packages across Languages" | ||
}, | ||
"APIForest": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "APITreeNode.json" | ||
}, | ||
"description": "The API Tree(s)" | ||
}, | ||
"Diagnostics": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "CodeDiagnostic.json" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"VersionString", | ||
"Name", | ||
"Language", | ||
"PackageName", | ||
"PackageVersion", | ||
"APIForest", | ||
"Diagnostics" | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/StructuredToken.json
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,41 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StructuredToken.json", | ||
"type": "object", | ||
"properties": { | ||
"Id": { | ||
"$ref": "StructuredTokenId.json", | ||
"description": "Token Id. Previously known as DefinitionId. Also the id used to place APIView comments. Needs to be deterministic" | ||
}, | ||
"Kind": { | ||
"$ref": "StructuredTokenKind.json", | ||
"description": "Represents the type of a structured token" | ||
}, | ||
"Value": { | ||
"type": "string", | ||
"description": "The token value which will be displayed. Spacing tokens (LineBreak, NonBreakingSpace, TabSpace, and ParameterSeparator) don't need to have value" | ||
}, | ||
"Properties": { | ||
"$ref": "StructuredTokenProperties.json", | ||
"description": "Properties of the StructuredToken." | ||
}, | ||
"Tags": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "StructuredTokenTags.json" | ||
}, | ||
"description": "Tags of the StructuredToken." | ||
}, | ||
"RenderClasses": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "StructuredTokenRenderClasses.json" | ||
}, | ||
"description": "Classes used to render the StructuredTokens." | ||
} | ||
}, | ||
"required": [ | ||
"Id", | ||
"Kind" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/StructuredTokenId.json
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 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StructuredTokenId.json", | ||
"type": "string" | ||
} |
12 changes: 12 additions & 0 deletions
12
tools/apiview/parsers/apiview-treestyle-parser-schema/json-schema/StructuredTokenKind.json
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,12 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StructuredTokenKind.json", | ||
"type": "number", | ||
"enum": [ | ||
0, | ||
1, | ||
2, | ||
3, | ||
4 | ||
] | ||
} |
Oops, something went wrong.