private _getPropertyDetails()

in libs/logic-apps-shared/src/parsers/lib/common/schemaprocessor.ts [476:564]


  private _getPropertyDetails(inputSchema: SchemaObject, $schema?: SchemaObject, isArrayItems = false): SchemaProperty | undefined {
    const { isInputSchema, parentProperty, permission: $permission, required: $required } = this.options;

    let keyPrefix = this.options.keyPrefix ? this.options.keyPrefix : '$';
    keyPrefix = isArrayItems ? `${keyPrefix}.${ParameterKeyUtility.WildIndexSegment}` : keyPrefix;

    const name = this._getName();
    const schema = $schema || inputSchema;
    const $default = schema.default;
    const contentHint = schema[SwaggerConstants.ExtensionProperties.ContentHint];
    const description = schema.description;
    const dynamicallyAdded = schema[SwaggerConstants.ExtensionProperties.DynamicallyAdded];
    const dynamicSchema = getParameterDynamicSchema(schema);
    const dynamicValues = getParameterDynamicValues(schema);
    const $enum = getEnum(schema, $required);
    const editor = getEditorForParameter(schema, dynamicValues, $enum);
    const editorOptions = getEditorOptionsForParameter(schema, dynamicValues, $enum);
    const encode = schema[SwaggerConstants.ExtensionProperties.Encode];
    const format = schema.format;
    const itemSchema = this._dereferenceRefSchema(schema.items as OpenApiSchema);
    const isInsideArray = parentProperty && parentProperty.isArray;
    const isNested = this.options.isNested;
    const isNotificationUrl = schema[SwaggerConstants.ExtensionProperties.NotificationUrl];
    const parentArray = parentProperty && parentProperty.arrayName;
    const permission = schema[SwaggerConstants.ExtensionProperties.Permission] || $permission;
    const readOnly = schema.readOnly;
    const recommended = schema[SwaggerConstants.ExtensionProperties.SchedulerRecommendation];
    const required = $required;
    let title = this._getTitle(
      schema.title || schema[SwaggerConstants.ExtensionProperties.Summary],
      this.options.currentKey as string,
      keyPrefix,
      name as string,
      schema.description
    );
    const summary = this._getSummary(schema[SwaggerConstants.ExtensionProperties.Summary], '');
    const type = (schema.type as string) || SwaggerConstants.Types.Any;
    const visibility = this._getVisibility(schema);
    const groupName = this._getGroupName(schema);
    const alias = this.options.useAliasedIndexing ? schema[SwaggerConstants.ExtensionProperties.Alias] : undefined;

    // Exclude read-only parameters from input schema, i.e., objects in Swagger body parameters.
    if (isInputSchema && this._isReadOnlyParameter(schema)) {
      return undefined;
    }

    if (!title && isInputSchema) {
      title = 'Body';
    }

    const dependencies = schema[SwaggerConstants.ExtensionProperties.InputDependencies];
    const serialization = schema[SwaggerConstants.ExtensionProperties.Serialization];
    const deserialization = schema[SwaggerConstants.ExtensionProperties.Deserialization];

    return {
      alias,
      contentHint,
      default: $default,
      description,
      dynamicallyAdded,
      dynamicSchema,
      dynamicValues,
      dependencies,
      editor,
      editorOptions,
      encode,
      enum: $enum,
      format,
      groupName,
      itemSchema,
      isInsideArray,
      isNested,
      isNotificationUrl,
      key: keyPrefix,
      name: name || title,
      parentArray,
      permission,
      readOnly,
      recommended,
      required,
      schema,
      serialization,
      deserialization,
      summary,
      title,
      type,
      visibility,
    };
  }