in libs/logic-apps-shared/src/parsers/lib/common/schemaprocessor.ts [254:366]
private _getObjectPropertyOutputs(
schema: SchemaObject,
keyPrefix: string | undefined,
titlePrefix: string | undefined,
summaryPrefix: string | undefined
): SchemaProperty[] {
const properties: Record<string, OpenApiSchema> = schema.properties || {};
const requiredProperties = schema.required || [];
const keys = Object.keys(properties);
const permission = schema[SwaggerConstants.ExtensionProperties.Permission] || this.options.permission;
const isReadOnlyInputParameter = this.options.isInputSchema && this._isReadOnlyParameter(schema);
const summary = schema[SwaggerConstants.ExtensionProperties.Summary];
let schemaProperties: SchemaProperty[] = [];
titlePrefix = this._concatenateString(titlePrefix, schema.title);
summaryPrefix = this._concatenateString(summaryPrefix, summary);
if (keys.length && !this._isInternalParameter(schema) && !isReadOnlyInputParameter) {
const outputs = keys.map((key) => {
const childOutput = properties[key] as SchemaObject;
let parentKeyPrefix = keyPrefix || this.options.keyPrefix;
parentKeyPrefix = parentKeyPrefix ? parentKeyPrefix : '$';
const childAlias = childOutput[SwaggerConstants.ExtensionProperties.Alias];
const childPropertyName = this.options.useAliasedIndexing && !!childAlias ? childAlias : key;
const encodedChildPropertyName = ParameterKeyUtility.encodePropertySegment(childPropertyName);
const childKeyPrefix = parentKeyPrefix ? `${parentKeyPrefix}.${encodedChildPropertyName}` : encodedChildPropertyName;
const prefix =
this.options.useAliasedIndexing && childAlias
? childAlias
: this.options.prefix
? `${this.options.prefix}.${encodedChildPropertyName}`
: encodedChildPropertyName;
const required = isNullOrUndefined(this.options.required)
? requiredProperties.indexOf(key) !== -1
: this.options.required && requiredProperties.indexOf(key) !== -1;
const parentProperty = { ...this.options.parentProperty, visibility: this._getVisibility(schema) };
const processor = new SchemaProcessor({
expandOneOf: this.options.expandOneOf,
selectAllOneOfSchemas: this.options.selectAllOneOfSchemas,
data: this.options.data,
dataKeyPrefix: this.options.dataKeyPrefix,
arrayOutputDepth: this.options.arrayOutputDepth,
currentKey: key,
excludeAdvanced: this.options.excludeAdvanced,
excludeInternal: this.options.excludeInternal,
expandArrayOutputs: this.options.expandArrayOutputs,
expandArrayOutputsDepth: this.options.expandArrayOutputsDepth,
fileParameterAware: this.options.fileParameterAware,
includeParentObject: this.options.includeParentObject,
isInputSchema: this.options.isInputSchema,
useAliasedIndexing: this.options.useAliasedIndexing,
isNested: true,
keyPrefix: childKeyPrefix,
metadata: this.options.metadata,
parentProperty,
permission,
prefix,
required,
summaryPrefix,
titlePrefix,
});
return processor.getSchemaProperties(childOutput);
});
schemaProperties = aggregate(outputs);
}
if (this.options.includeParentObject && !isReadOnlyInputParameter) {
const name = this._getName() as string;
const dynamicValues = getParameterDynamicValues(schema);
const key = keyPrefix || this.options.keyPrefix || '$';
const description = schema.description;
const $enum = getEnum(schema, this.options.required);
schemaProperties.push({
alias: this.options.useAliasedIndexing ? schema[SwaggerConstants.ExtensionProperties.Alias] : undefined,
default: schema.default,
description,
dynamicValues,
dynamicSchema: getParameterDynamicSchema(schema),
enum: $enum,
editor: getEditorForParameter(schema, dynamicValues, $enum),
editorOptions: getEditorOptionsForParameter(schema, dynamicValues, $enum),
format: schema.format,
isInsideArray: this.options.parentProperty && this.options.parentProperty.isArray,
isNested: this.options.isNested,
isNotificationUrl: schema[SwaggerConstants.ExtensionProperties.NotificationUrl],
key,
parentArray: this.options.parentProperty && this.options.parentProperty.arrayName,
permission,
name,
readOnly: schema.readOnly,
recommended: schema[SwaggerConstants.ExtensionProperties.SchedulerRecommendation],
required: this.options.required,
schema,
summary: this._getSummary(summary, ''),
title: this._getTitle(
schema.title || schema[SwaggerConstants.ExtensionProperties.Summary],
this.options.currentKey as string,
key,
name,
description
),
type: SwaggerConstants.Types.Object,
visibility: this._getVisibility(schema),
});
}
return this._sortProperties(schemaProperties);
}