process()

in packages/extensions/modelerfour/src/modeler/modelerfour.ts [2499:2557]


  process() {
    this.codeModel.security = this.securityProcessor.process(this.input);
    let priority = 0;
    for (const { key: name, value: parameter } of this.resolveDictionary(this.input.components?.parameters)) {
      if (parameter["x-ms-parameter-location"] !== "method") {
        if (parameter["x-ms-priority"] === undefined) {
          parameter["x-ms-priority"] = priority++;
        }
      }
    }

    if (this.input.paths) {
      for (const { operation, method, path, pathItem } of this.inputOperations) {
        this.processOperation(operation, method, path, pathItem);
      }

      for (const group of this.codeModel.operationGroups) {
        for (const operation of group.operations) {
          const nl = operation.language.default.paging;
          if (nl && nl.member) {
            // find the member in the group
            const it = group.operations.find((each) => each.language.default.name === nl.member);
            operation.language.default.paging.nextLinkOperation = it;
          }
        }
      }
    }
    if (this.input.components) {
      for (const { key: name, value: header } of this.resolveDictionary(this.input.components.headers)) {
        // TODO Figure out if needed
      }

      for (const { key: name, value: request } of this.resolveDictionary(this.input.components.requestBodies)) {
        // TODO Figure out if needed
      }
      for (const { key: name, value: response } of this.resolveDictionary(this.input.components.responses)) {
        // TODO Figure out if needed
      }
      for (const { key: name, value: schema } of this.resolveDictionary(this.input.components.schemas)) {
        // we don't process binary schemas
        if (this.interpret.isBinarySchema(schema)) {
          continue;
        }

        // if this schema is an empty object with no heirarchy, skip it.
        if (this.interpret.isEmptyObject(schema)) {
          continue;
        }
        this.processSchema(name, schema);
      }
    }

    // Propagate schema usage information to other object schemas.
    // This must occur after all schemas have been visited to ensure
    // nothing gets missed (like discriminator schemas).
    this.codeModel.schemas.objects?.forEach((o) => this.propagateSchemaUsage(o));

    return this.codeModel;
  }