@microsoft/m365-spec-parser 0.2.4-rc.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,6 @@ export declare class ConstantString {
16
16
  static readonly SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
17
17
  static readonly MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
18
18
  static readonly OperationIdContainsSpecialCharacters = "Operation id '%s' in OpenAPI description document contained special characters and was renamed to '%s'.";
19
- static readonly AuthTypeIsNotSupported = "Unsupported authorization type in API '%s'. No authorization will be used.";
20
19
  static readonly UnsupportedSchema = "Unsupported schema in %s %s: %s";
21
20
  static readonly FuncDescriptionTooLong = "The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.";
22
21
  static readonly GenerateJsonDataFailed = "Failed to generate JSON data for api: %s due to %s.";
@@ -26,12 +25,14 @@ export declare class ConstantString {
26
25
  static readonly GetMethod = "get";
27
26
  static readonly PostMethod = "post";
28
27
  static readonly AdaptiveCardVersion = "1.5";
29
- static readonly AdaptiveCardSchema = "https://adaptivecards.io/schemas/adaptive-card.json";
28
+ static readonly AdaptiveCardSchema = "http://adaptivecards.io/schemas/adaptive-card.json";
30
29
  static readonly AdaptiveCardType = "AdaptiveCard";
31
30
  static readonly TextBlockType = "TextBlock";
32
31
  static readonly ImageType = "Image";
33
32
  static readonly ContainerType = "Container";
34
- static readonly RegistrationIdPostfix = "REGISTRATION_ID";
33
+ static readonly RegistrationIdPostfix: {
34
+ [key: string]: string;
35
+ };
35
36
  static readonly ResponseCodeFor20X: string[];
36
37
  static readonly AllOperationMethods: string[];
37
38
  static readonly WellknownResultNames: string[];
@@ -96,8 +96,11 @@ export declare enum ErrorType {
96
96
  PostBodyContainMultipleMediaTypes = "post-body-contain-multiple-media-types",
97
97
  ResponseContainMultipleMediaTypes = "response-contain-multiple-media-types",
98
98
  ResponseJsonIsEmpty = "response-json-is-empty",
99
+ PostBodySchemaIsNotJson = "post-body-schema-is-not-json",
99
100
  PostBodyContainsRequiredUnsupportedSchema = "post-body-contains-required-unsupported-schema",
100
101
  ParamsContainRequiredUnsupportedSchema = "params-contain-required-unsupported-schema",
102
+ ParamsContainsNestedObject = "params-contains-nested-object",
103
+ RequestBodyContainsNestedObject = "request-body-contains-nested-object",
101
104
  ExceededRequiredParamsLimit = "exceeded-required-params-limit",
102
105
  NoParameter = "no-parameter",
103
106
  NoAPIInfo = "no-api-info",
@@ -116,7 +119,6 @@ export declare enum WarningType {
116
119
  ConvertSwaggerToOpenAPI = "convert-swagger-to-openapi",
117
120
  FuncDescriptionTooLong = "function-description-too-long",
118
121
  OperationIdContainsSpecialCharacters = "operationid-contains-special-characters",
119
- UnsupportedAuthType = "unsupported-auth-type",
120
122
  GenerateJsonDataFailed = "generate-json-data-failed",
121
123
  Unknown = "unknown"
122
124
  }
@@ -282,12 +284,3 @@ export interface ExistingPluginManifestInfo {
282
284
  manifestPath: string;
283
285
  specPath: string;
284
286
  }
285
- export interface OperationAuthInfoMap {
286
- [operationId: string]: AuthInfo;
287
- }
288
- export interface FunctionClassificationMap {
289
- [authType: string]: {
290
- functionNames: string[];
291
- authName: string;
292
- };
293
- }
@@ -1,11 +1,11 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
- import { AuthInfo, ExistingPluginManifestInfo, OperationAuthInfoMap, ParseOptions, WarningResult } from "./interfaces";
2
+ import { AuthInfo, ExistingPluginManifestInfo, ParseOptions, WarningResult } from "./interfaces";
3
3
  import { IMessagingExtensionCommand, TeamsAppManifest, PluginManifestSchema } from "@microsoft/teams-manifest";
4
4
  export declare class ManifestUpdater {
5
- static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions, authMap: OperationAuthInfoMap, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[]]>;
5
+ static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions, authInfo?: AuthInfo, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[]]>;
6
6
  static updateManifestDescription(manifest: TeamsAppManifest, spec: OpenAPIV3.Document): void;
7
7
  static checkSchema(schema: OpenAPIV3.SchemaObject, method: string, pathUrl: string): void;
8
- static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, apiPluginFilePath: string, appName: string, authMap: OperationAuthInfoMap, options: ParseOptions, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[PluginManifestSchema, WarningResult[]]>;
8
+ static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, apiPluginFilePath: string, appName: string, authInfo: AuthInfo | undefined, options: ParseOptions, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[PluginManifestSchema, WarningResult[]]>;
9
9
  static updateManifest(manifestPath: string, outputSpecPath: string, spec: OpenAPIV3.Document, options: ParseOptions, adaptiveCardFolder?: string, authInfo?: AuthInfo): Promise<[TeamsAppManifest, WarningResult[]]>;
10
10
  static generateCommands(spec: OpenAPIV3.Document, manifestPath: string, options: ParseOptions, adaptiveCardFolder?: string): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
11
11
  static getRelativePath(from: string, to: string): string;
@@ -12,7 +12,6 @@ export declare class SpecParser {
12
12
  private spec;
13
13
  private unResolveSpec;
14
14
  private isSwaggerFile;
15
- private readonly refParser;
16
15
  private defaultOptions;
17
16
  /**
18
17
  * Creates a new instance of the SpecParser class.
@@ -38,7 +37,6 @@ export declare class SpecParser {
38
37
  * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
39
38
  */
40
39
  getFilteredSpecs(filter: string[], signal?: AbortSignal): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]>;
41
- private deReferenceSpec;
42
40
  /**
43
41
  * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
44
42
  * @param manifestPath A file path of the Teams app manifest file to update.
@@ -1,27 +1,24 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
- import { AuthInfo, AuthType, ErrorResult, OperationAuthInfoMap, ParseOptions } from "./interfaces";
2
+ import { AuthInfo, AuthType, ErrorResult, ParseOptions } from "./interfaces";
3
3
  import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
4
4
  export declare class Utils {
5
+ static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
5
6
  static isObjectSchema(schema: OpenAPIV3.SchemaObject): boolean;
6
7
  static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
7
8
  static isBearerTokenAuth(authScheme: AuthType): boolean;
8
9
  static isAPIKeyAuth(authScheme: AuthType): boolean;
9
- static isAPIKeyAuthButNotInCookie(authScheme: AuthType): boolean;
10
10
  static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean;
11
- static isNotSupportedAuth(authSchemeArray: AuthInfo[][]): boolean;
12
11
  static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
13
- static getAuthMap(spec: OpenAPIV3.Document): OperationAuthInfoMap;
14
12
  static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined;
15
13
  static updateFirstLetter(str: string): string;
16
14
  static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, allowMultipleMediaType?: boolean): {
17
15
  json: OpenAPIV3.MediaTypeObject;
18
16
  multipleMediaType: boolean;
19
17
  };
20
- static getJsonContentType(responseObject: OpenAPIV3.ResponseObject | OpenAPIV3.RequestBodyObject): OpenAPIV3.MediaTypeObject;
21
18
  static convertPathToCamelCase(path: string): string;
22
19
  static getUrlProtocol(urlString: string): string | undefined;
23
20
  static resolveEnv(str: string): string;
24
- static checkServerUrl(servers: OpenAPIV3.ServerObject[], allowHttp?: boolean): ErrorResult[];
21
+ static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
25
22
  static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[];
26
23
  static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
27
24
  static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/m365-spec-parser",
3
- "version": "0.2.4-rc.0",
3
+ "version": "0.2.4",
4
4
  "description": "OpenAPI specification files Parser for M365 Apps",
5
5
  "main": "dist/index.node.cjs.js",
6
6
  "browser": "dist/index.esm2017.js",
@@ -38,9 +38,8 @@
38
38
  "homepage": "https://github.com/OfficeDev/TeamsFx",
39
39
  "sideEffects": false,
40
40
  "dependencies": {
41
- "@apidevtools/json-schema-ref-parser": "^11.7.2",
42
41
  "@apidevtools/swagger-parser": "^10.1.0",
43
- "@microsoft/teams-manifest": "0.1.8-rc.0",
42
+ "@microsoft/teams-manifest": "0.1.8",
44
43
  "fs-extra": "^11.2.0",
45
44
  "js-yaml": "^4.1.0",
46
45
  "openapi-types": "^7.2.3",
@@ -50,6 +49,7 @@
50
49
  "access": "public"
51
50
  },
52
51
  "devDependencies": {
52
+ "@apidevtools/json-schema-ref-parser": "^9.0.6",
53
53
  "@apidevtools/openapi-schemas": "2.1.0",
54
54
  "@apidevtools/swagger-methods": "3.0.2",
55
55
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
@@ -147,5 +147,5 @@
147
147
  "npx eslint --cache --fix --quiet"
148
148
  ]
149
149
  },
150
- "gitHead": "15d0aaa8d3ea3292a821b00f1dbe23510c109695"
150
+ "gitHead": "7e4dc9364906e17944f90db96f77fd3838da9fa4"
151
151
  }