{
  "title": "API Extractor Configuration",
  "description": "Describes how the API Extractor tool will process a project.",
  "type": "object",
  "properties": {
    "$schema": {
      "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
      "type": "string"
    },

    "extends": {
      "description": "Optionally specifies another JSON config file that this file extends from.  This provides a way for standard settings to be shared across multiple projects.",
      "type": "string"
    },

    "projectFolder": {
      "description": "Determines the \"<projectFolder>\" token that can be used with other config file settings.  The project folder typically contains the tsconfig.json and package.json config files, but the path is user-defined.  The path is resolved relative to the folder of the config file that contains the setting.  The default value for \"projectFolder\" is the token \"<lookup>\", which means the folder is determined using the following heuristics:\n\nIf the config/rig.json system is used (as defined by @rushstack/rig-package), then the \"<lookup>\" value will be the package folder that referenced the rig.\n\nOtherwise, the \"<lookup>\" value is determined by traversing parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder that contains a tsconfig.json file.  If a tsconfig.json file cannot be found in this way, then an error will be reported.",
      "type": "string"
    },

    "mainEntryPointFilePath": {
      "description": "Specifies the .d.ts file to be used as the starting point for analysis.  API Extractor analyzes the symbols exported by this module. The file extension must be \".d.ts\" and not \".ts\". The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
      "type": "string"
    },

    "bundledPackages": {
      "description": "A list of NPM package names whose exports should be treated as part of this package. Also supports glob patterns.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },

    "newlineKind": {
      "description": "Specifies what type of newlines API Extractor should use when writing output files.  By default, the output files will be written with Windows-style newlines.  To use POSIX-style newlines, specify \"lf\" instead. To use the OS's default newline kind, specify \"os\".",
      "type": "string",
      "enum": ["crlf", "lf", "os"],
      "default": "crlf"
    },

    "enumMemberOrder": {
      "description": "Specifies how API Extractor sorts the members of an enum when generating the .api.json doc model. \n 'by-name': sort the items according to the enum member name \n 'preserve': keep the original order that items appear in the source code",
      "type": "string",
      "enum": ["by-name", "preserve"],
      "default": "by-name"
    },

    "testMode": {
      "description": "Set to true invoking API Extractor's test harness. When \"testMode\" is true, the \"toolVersion\" field in the .api.json file is assigned an empty string to prevent spurious diffs in output files tracked for tests.",
      "type": "boolean"
    },

    "compiler": {
      "description": "Determines how the TypeScript compiler engine will be invoked by API Extractor.",
      "type": "object",
      "properties": {
        "tsconfigFilePath": {
          "description": "Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.  The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".  Note: This setting will be ignored if \"overrideTsconfig\" is used.",
          "type": "string"
        },
        "overrideTsconfig": {
          "description": "Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. The object must conform to the TypeScript tsconfig schema: http://json.schemastore.org/tsconfig  If omitted, then the tsconfig.json file will be read from the \"projectFolder\".",
          "type": "object"
        },
        "skipLibCheck": {
          "description": "This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses for its analysis.  Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },

    "apiReport": {
      "description": "Configures how the API report file (*.api.md) will be generated.",
      "type": "object",
      "properties": {
        "enabled": {
          "description": "Whether to generate an API report.",
          "type": "boolean"
        },

        "reportFileName": {
          "description": "The base filename for the API report files, to be combined with \"reportFolder\" or \"reportTempFolder\" to produce the full file path.  The \"reportFileName\" should not include any path separators such as \"\\\" or \"/\".  The \"reportFileName\" should not include a file extension, since API Extractor will automatically append an appropriate file extension such as \".api.md\".  If the \"reportVariants\" setting is used, then the file extension includes the variant name, for example \"my-report.public.api.md\" or \"my-report.beta.api.md\".  The \"complete\" variant always uses the simple extension \"my-report.api.md\".\n\nPrevious versions of API Extractor required \"reportFileName\" to include the \".api.md\" extension explicitly; for backwards compatibility, that is still accepted but will be discarded before applying the above rules.",
          "type": ["string"]
        },

        "reportVariants": {
          "description": "To support different approval requirements for different API levels, multiple \"variants\" of the API report can be generated.  The \"reportVariants\" setting specifies a list of variants to be generated.  If omitted, by default only the \"complete\" variant will be generated, which includes all @internal, @alpha, @beta, and @public items.  Other possible variants are \"alpha\" (@alpha + @beta + @public), \"beta\" (@beta + @public), and \"public\" (@public only).",
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["public", "beta", "alpha", "complete"]
          }
        },

        "reportFolder": {
          "description": "Specifies the folder where the API report file is written.  The file name portion is determined by the \"reportFileName\" setting. The API report file is normally tracked by Git.  Changes to it can be used to trigger a branch policy, e.g. for an API review. The path is resolved relative to the folder of the config file that contains the setting; to change this,  prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },

        "reportTempFolder": {
          "description": "Specifies the folder where the temporary report file is written.  The file name portion is determined by the \"reportFileName\" setting. After the temporary file is written to disk, it is compared with the file in the \"reportFolder\". If they are different, a production build will fail. The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },

        "includeForgottenExports": {
          "description": "Whether \"forgotten exports\" should be included in the API report file. Forgotten exports are declarations flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to learn more.",
          "type": "boolean"
        }
      },
      "required": ["enabled"],
      "additionalProperties": false
    },

    "docModel": {
      "description": "Configures how the doc model file (*.api.json) will be generated.",
      "type": "object",
      "properties": {
        "enabled": {
          "description": "Whether to generate doc model file.",
          "type": "boolean"
        },
        "apiJsonFilePath": {
          "description": "The output path for the doc model file.  The file extension should be \".api.json\". The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },
        "includeForgottenExports": {
          "description": "Whether \"forgotten exports\" should be included in the doc model file. Forgotten exports are declarations flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to learn more.",
          "type": "boolean"
        },
        "projectFolderUrl": {
          "description": "The base URL where the project's source code can be viewed on a website such as GitHub or Azure DevOps. This URL path corresponds to the `<projectFolder>` path on disk. This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items. For example, if the `projectFolderUrl` is \"https://github.com/microsoft/rushstack/tree/main/apps/api-extractor\" and an API item's file path is \"api/ExtractorConfig.ts\", the full URL file path would be \"https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js\". Can be omitted if you don't need source code links in your API documentation reference.",
          "type": "string"
        }
      },
      "required": ["enabled"],
      "additionalProperties": false
    },

    "dtsRollup": {
      "description": "Configures how the .d.ts rollup file will be generated.",
      "type": "object",
      "properties": {
        "enabled": {
          "description": "Whether to generate the .d.ts rollup file.",
          "type": "boolean"
        },
        "untrimmedFilePath": {
          "description": "Specifies the output path for a .d.ts rollup file to be generated without any trimming. This file will include all declarations that are exported by the main entry point. If the path is an empty string, then this file will not be written. The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },
        "alphaTrimmedFilePath": {
          "description": "Specifies the output path for a .d.ts rollup file to be generated with trimming for an \"alpha\" release. This file will include only declarations that are marked as \"@public\", \"@beta\", or \"@alpha\". The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },
        "betaTrimmedFilePath": {
          "description": "Specifies the output path for a .d.ts rollup file to be generated with trimming for a \"beta\" release. This file will include only declarations that are marked as \"@public\" or \"@beta\". The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },
        "publicTrimmedFilePath": {
          "description": "Specifies the output path for a .d.ts rollup file to be generated with trimming for a \"public\" release. This file will include only declarations that are marked as \"@public\". If the path is an empty string, then this file will not be written. The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\".",
          "type": "string"
        },
        "omitTrimmingComments": {
          "description": "When a declaration is trimmed, by default it will be replaced by a code comment such as \"Excluded from this release type: exampleMember\".  Set \"omitTrimmingComments\" to true to remove the declaration completely.",
          "type": "boolean"
        }
      },
      "required": ["enabled"],
      "additionalProperties": false
    },

    "tsdocMetadata": {
      "description": "Configures how the tsdoc-metadata.json file will be generated.",
      "type": "object",
      "properties": {
        "enabled": {
          "description": "Whether to generate the tsdoc-metadata.json file.",
          "type": "boolean"
        },
        "tsdocMetadataFilePath": {
          "description": "Specifies where the TSDoc metadata file should be written. The path is resolved relative to the folder of the config file that contains the setting; to change this, prepend a folder token such as \"<projectFolder>\". The default value is \"<lookup>\", which causes the path to be automatically inferred from the \"tsdocMetadata\", \"typings\" or \"main\" fields of the project's package.json.  If none of these fields are set, the lookup falls back to \"tsdoc-metadata.json\" in the package folder.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },

    "messages": {
      "description": "Configures how API Extractor reports error and warning messages produced during analysis.",
      "type": "object",
      "properties": {
        "compilerMessageReporting": {
          "description": "Configures handling of diagnostic messages generating the TypeScript compiler while analyzing the input .d.ts files.",
          "$ref": "#/definitions/extractorMessageReportingTable"
        },
        "extractorMessageReporting": {
          "description": "Configures handling of messages reported by API Extractor during its analysis.",
          "$ref": "#/definitions/extractorMessageReportingTable"
        },
        "tsdocMessageReporting": {
          "description": "Configures handling of messages reported by the TSDoc parser when analyzing code comments.",
          "$ref": "#/definitions/extractorMessageReportingTable"
        }
      },
      "additionalProperties": false
    }
  },
  "required": ["mainEntryPointFilePath"],
  "additionalProperties": false,

  "definitions": {
    "extractorMessageReportingTable": {
      "type": "object",
      "description": "Specifies a table of reporting rules for different message identifiers, and also the default rule used for identifiers that do not appear in the table. The key is a message identifier for the associated type of message, or \"default\" to specify the default policy. For example, the key might be \"TS2551\" (a compiler message), \"tsdoc-link-tag-unescaped-text\" (a TSDOc message), or \"ae-extra-release-tag\" (a message related to the API Extractor analysis).",
      "patternProperties": {
        ".+": {
          "type": "object",
          "description": "Configures reporting for a given message identifier.",
          "properties": {
            "logLevel": {
              "type": "string",
              "description": "Specifies whether the message should be written to the the tool's output log. Note that the \"addToApiReportFile\" property may supersede this option.",
              "enum": ["error", "warning", "none"]
            },
            "addToApiReportFile": {
              "type": "boolean",
              "description": "If API Extractor is configured to write an API review file (.api.md), then the message will be written inside that file.  If the API review file is NOT being written, then the message is instead logged according to the \"logLevel\" option."
            }
          },
          "additionalProperties": false,
          "required": ["logLevel"]
        }
      },
      "additionalProperties": false
    }
  }
}
