[js-apiview-parser] update CodeFile models from schemas (#9256)

* [js-apiview-parser] update CodeFile models from schemas

* Update version and changelog

* set SkipDiff: true for all dependency tokens

* update code owners
This commit is contained in:
Jeremy Meng 2024-11-12 10:29:34 -08:00 коммит произвёл GitHub
Родитель b1536534cd
Коммит 18a51f2b59
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
5 изменённых файлов: 30 добавлений и 7 удалений

2
.github/CODEOWNERS поставляемый
Просмотреть файл

@ -67,7 +67,7 @@
/tools/apiview/emitters/typespec-apiview @tjprescott
/tools/apiview/parsers/cpp-api-parser @LarryOsterman
/tools/apiview/parsers/csharp-api-parser @christothes
/tools/apiview/parsers/js-api-parser @maorleger
/tools/apiview/parsers/js-api-parser @jeremymeng @maorleger
/src/swift @tjprescott
/src/java/apiview-java-processor @JonathanGiles
/src/go @jhendrixMSFT @chlowell @RickWinter

Просмотреть файл

@ -1,3 +1,7 @@
# 2.0.4
- update models from latest CodeFile schemas
# 2.0.3
- add `SkipDiff: true` for dependency header line

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@azure-tools/ts-genapi",
"version": "2.0.3",
"version": "2.0.4",
"description": "",
"main": "index.js",
"publishConfig": {

Просмотреть файл

@ -67,6 +67,7 @@ function buildDependencies(reviewLines: ReviewLine[], dependencies: Record<strin
const nameToken: ReviewToken = buildToken({
Kind: TokenKind.StringLiteral,
Value: dependency,
SkipDiff: true,
});
const versionToken: ReviewToken = buildToken({
Kind: TokenKind.StringLiteral,
@ -74,7 +75,11 @@ function buildDependencies(reviewLines: ReviewLine[], dependencies: Record<strin
SkipDiff: true,
});
const dependencyLine: ReviewLine = {
Tokens: [nameToken, buildToken({ Kind: TokenKind.Punctuation, Value: ":" }), versionToken],
Tokens: [
nameToken,
buildToken({ Kind: TokenKind.Punctuation, Value: ":", SkipDiff: true }),
versionToken,
],
};
dependencyLines.push(dependencyLine);
}

Просмотреть файл

@ -24,9 +24,14 @@ export interface CodeFile {
/** Language variant is applicable only for java variants */
LanguageVariant?: "None" | "Spring" | "Android";
CrossLanguagePackageId?: string;
ReviewLines: ReviewLine[];
ReviewLines: Array<ReviewLine>;
/** Add any system generated comments. Each comment is linked to review line ID */
Diagnostics?: CodeDiagnostic[];
Diagnostics?: Array<CodeDiagnostic>;
/**
* Navigation items are used to create a tree view in the navigation panel. Each navigation item is linked to a review line ID. This is optional.
* If navigation items are not provided then navigation panel will be automatically generated using the review lines. Navigation items should be provided only if you want to customize the navigation panel.
*/
Navigation?: Array<NavigationItem>;
}
/** ReviewLine object corresponds to each line displayed on API review. If an empty line is required then add a code line object without any token. */
@ -40,12 +45,12 @@ export interface ReviewLine {
LineId?: string;
CrossLanguageId?: string;
/** list of tokens that constructs a line in API review */
Tokens: ReviewToken[];
Tokens: Array<ReviewToken>;
/**
* Add any child lines as children. For e.g. all classes and namespace level methods are added as a children of namespace(module) level code line.
* Similarly all method level code lines are added as children of it's class code line.
*/
Children?: ReviewLine[];
Children?: Array<ReviewLine>;
/** Set current line as hidden code line by default. .NET has hidden APIs and architects don't want to see them by default. */
IsHidden?: boolean;
/** Set current line as context end line. For e.g. line with token } or empty line after the class to mark end of context. */
@ -77,6 +82,8 @@ export interface ReviewToken {
IsDeprecated?: boolean;
/** Set this to false if there is no suffix space required before next token. For e.g, punctuation right after method name */
HasSuffixSpace?: boolean;
/** Set this to true if there is a prefix space required before current token. For e.g, space before token for = */
HasPrefixSpace?: boolean;
/** Set isDocumentation to true if current token is part of documentation */
IsDocumentation?: boolean;
/** Language specific style css class names */
@ -95,6 +102,13 @@ export interface CodeDiagnostic {
HelpLinkUri?: string;
}
export interface NavigationItem {
Text: string;
NavigationId: string;
ChildItems: Array<NavigationItem>;
Tags: Record<string, string>;
}
export enum TokenKind {
Text = 0,
Punctuation = 1,