Skip to content

Commit 232322a

Browse files
preetriti1Priti Sambandam
andauthored
fix(designer): Fixing the swagger schema returned for http swagger operation (Azure#3375)
Co-authored-by: Priti Sambandam <psamband@microsoft.com>
1 parent de14380 commit 232322a

File tree

8 files changed

+141
-300
lines changed

8 files changed

+141
-300
lines changed

apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesigner.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,12 @@ const getDesignerServices = (
350350
},
351351
getSwaggerOperationSchema: (args: any) => {
352352
const { parameters, isInput } = args;
353-
return appService.getOperationSchema(parameters.swaggerUrl, parameters.operationId, isInput);
353+
return appService.getOperationSchema(
354+
parameters.swaggerUrl,
355+
parameters.operationId,
356+
isInput,
357+
true /* supportsAuthenticationParameter */
358+
);
354359
},
355360
},
356361
valuesClient: {

apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,21 @@ const getDesignerServices = (
246246
},
247247
getSwaggerOperationSchema: (args: any) => {
248248
const { parameters, isInput } = args;
249-
return appServiceService.getOperationSchema(parameters.swaggerUrl, parameters.operationId, isInput);
249+
return appServiceService.getOperationSchema(
250+
parameters.swaggerUrl,
251+
parameters.operationId,
252+
isInput,
253+
true /* supportsAuthenticationParameter */
254+
);
255+
},
256+
getAppserviceSwaggerOperationSchema: (args: any) => {
257+
const { parameters, isInput } = args;
258+
return appServiceService.getOperationSchema(
259+
parameters.swaggerUrl,
260+
parameters.operationId,
261+
isInput,
262+
false /* supportsAuthenticationParameter */
263+
);
250264
},
251265
getMapSchema: (_args: any) => {
252266
throw new Error('getMapSchema not implemented for consumption standalone');

apps/vs-code-designer-react/src/app/servicesHelper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ export const getDesignerServices = (
164164
},
165165
getSwaggerOperationSchema: (args: any) => {
166166
const { parameters, isInput } = args;
167-
return appService.getOperationSchema(parameters.swaggerUrl, parameters.operationId, isInput);
167+
return appService.getOperationSchema(
168+
parameters.swaggerUrl,
169+
parameters.operationId,
170+
isInput,
171+
true /* supportsAuthenticationParameter */
172+
);
168173
},
169174
},
170175
valuesClient: {

libs/services/designer-client-services/src/lib/appService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AssertionErrorCode, AssertionException } from '@microsoft/utils-logic-a
22

33
export interface IAppServiceService {
44
fetchAppServices(): Promise<any>;
5-
getOperationSchema(swaggerUrl: string, operationId: string, isInput: boolean): Promise<any>;
5+
getOperationSchema(swaggerUrl: string, operationId: string, isInput: boolean, supportsAuthenticationParameter: boolean): Promise<any>;
66
getOperations(swaggerUrl: string): Promise<any>;
77
}
88

libs/services/designer-client-services/src/lib/base/appService.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ export class BaseAppServiceService implements IAppServiceService {
3838
return response.filter(connectorIsAppService);
3939
}
4040

41-
async getOperationSchema(swaggerUrl: string, operationId: string, isInput: boolean): Promise<any> {
41+
async getOperationSchema(
42+
swaggerUrl: string,
43+
operationId: string,
44+
isInput: boolean,
45+
supportsAuthenticationParameter: boolean
46+
): Promise<any> {
4247
if (!swaggerUrl) return Promise.resolve();
4348
const swagger = await this.fetchAppServiceApiSwagger(swaggerUrl);
4449
if (!operationId) return Promise.resolve();
@@ -68,6 +73,19 @@ export class BaseAppServiceService implements IAppServiceService {
6873
for (const parameter of rawOperation.parameters ?? []) {
6974
this._addParameterInSchema(schema, parameter);
7075
}
76+
77+
if (supportsAuthenticationParameter) {
78+
schema.properties['authentication'] = {
79+
type: 'object',
80+
title: 'Authentication',
81+
description: 'Enter JSON object of authentication parameter',
82+
'x-ms-visibility': 'advanced',
83+
'x-ms-editor': 'authentication',
84+
'x-ms-editor-options': {
85+
supportedAuthTypes: ['None', 'Basic', 'ClientCertificate', 'ActiveDirectoryOAuth', 'Raw', 'ManagedServiceIdentity'],
86+
},
87+
};
88+
}
7189
} else {
7290
const { responses } = rawOperation;
7391
let response: any = {};

libs/services/designer-client-services/src/lib/base/manifests/http.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ export const httpWithSwaggerManifest = {
212212
inputs: {
213213
type: 'object',
214214
properties: {
215-
authentication: authenticationParameter,
216215
// Dynamic Params
217216
operationId: {
218217
required: true,
@@ -244,7 +243,6 @@ export const httpWithSwaggerManifest = {
244243
},
245244
},
246245
operationDetails: {
247-
title: 'Swagger Parameters',
248246
description: 'Enter all swagger parameters',
249247
'x-ms-dynamic-properties': {
250248
dynamicState: {

libs/services/designer-client-services/src/lib/consumption/manifests/appServices.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ export const appServiceActionManifest = {
7474
},
7575
},
7676
operationDetails: {
77-
title: 'Operation Parameters',
7877
description: 'Operation parameters for the above operation',
7978
'x-ms-dynamic-properties': {
8079
dynamicState: {
8180
extension: {
82-
operationId: 'getSwaggerOperationSchema',
81+
operationId: 'getAppserviceSwaggerOperationSchema',
8382
},
8483
isInput: true,
8584
},
@@ -124,7 +123,7 @@ export const appServiceActionManifest = {
124123
'x-ms-dynamic-properties': {
125124
dynamicState: {
126125
extension: {
127-
operationId: 'getSwaggerOperationSchema',
126+
operationId: 'getAppserviceSwaggerOperationSchema',
128127
},
129128
},
130129
parameters: {

0 commit comments

Comments
 (0)