{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/buf.plugin.json",
  "$comment": "https://github.com/bufbuild/plugins/blob/main/CONTRIBUTING.md",
  "title": "buf.plugin.yaml",
  "description": "A `buf.plugin.yaml` file captures metadata about the plugin. It includes mandatory and optional fields that are displayed on the individual plugin page and the BSR plugin homepage at https://buf.build/plugins.",
  "type": "object",
  "required": ["version", "name", "plugin_version"],
  "properties": {
    "version": {
      "description": "The YAML configuration version, must be `v1`.",
      "type": "string",
      "const": "v1"
    },
    "name": {
      "description": "The plugin identity with format `{remote}/{organization_name}/{plugin_name}`.",
      "type": "string"
    },
    "plugin_version": {
      "description": "The plugin version with format`v{semver}`, the `v` prefix is required and the version must be valid [semantic versioning](https://semver.org/).",
      "type": "string"
    },
    "source_url": {
      "description": "URL to the source code of the Protobuf plugin.",
      "type": "string"
    },
    "description": {
      "description": "Description of the plugin.",
      "type": "string"
    },
    "output_languages": {
      "description": "The output language types generated by the plugin. See the PluginLanguage enum for existing languages. Open a GitHub issue in the Buf CLI (https://github.com/bufbuild/buf) if the output language isn't found for a plugin.",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "go",
          "javascript",
          "typescript",
          "swift",
          "cpp",
          "java",
          "dart",
          "rust",
          "python",
          "ruby",
          "kotlin",
          "objective_c",
          "php",
          "csharp",
          "scala",
          "c"
        ]
      }
    },
    "spdx_license_id": {
      "description": "The license id for the plugin from https://spdx.org/licenses.",
      "type": "string"
    },
    "integration_guide_url": {
      "description": "The URL to the integration guide for the plugin.",
      "type": "string"
    },
    "deps": {
      "description": "A list of dependencies on other plugins used by Generated SDKs.",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["plugin"],
        "properties": {
          "plugin": {
            "description": "The reference to the plugin dependency with format `{name}:{plugin_version}`.",
            "type": "string"
          },
          "revision": {
            "description": "If specified, the dependency will be to a specific version of a plugin. It is recommended to leave this off (the plugin will depend on the latest revision at time of publishing).",
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "registry": {
      "description": "Configuration to enable a plugin for use with Generated SDKs.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "opts": {
          "description": "Options supplied to the plugin when generating code for the SDK.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "go": {
          "description": "Generated SDK configuration for a Go plugin.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "min_version": {
              "description": "The minimum Go version required by the plugin (e.g. `1.19`), used as the go directive in the `go.mod` file. See https://go.dev/ref/mod#go-mod-file-go.",
              "type": "string"
            },
            "deps": {
              "description": "A list of Go module requirements. Each requirement corresponds to a require directive in the `go.mod` file. See https://go.dev/ref/mod#go-mod-file-require.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "module": {
                    "description": "Go module name.",
                    "type": "string"
                  },
                  "version": {
                    "description": "Go module version.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "npm": {
          "description": "Generated SDK configuration for a JavaScript/TypeScript plugin.",
          "type": "object",
          "additionalProperties": false,
          "required": ["import_style"],
          "properties": {
            "rewrite_import_path_suffix": {
              "description": "The suffix used in the generated files and their imported dependencies (supported by @bufbuild/protoplugin (https://www.npmjs.com/package/@bufbuild/protoplugin) plugins).",
              "type": "string"
            },
            "deps": {
              "description": "NPM package dependencies for the Generated SDK.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "package": {
                    "description": "The name of the NPM package dependency.",
                    "type": "string"
                  },
                  "version": {
                    "description": "The version of the NPM package dependency (see https://docs.npmjs.com/about-semantic-versioning#using-semantic-versioning-to-specify-update-types-your-package-can-accept for more details).",
                    "type": "string"
                  }
                }
              }
            },
            "import_style": {
              "description": "One of either `module` or `commonjs`.",
              "type": "string",
              "enum": ["module", "commonjs"]
            }
          }
        },
        "maven": {
          "description": "Generated SDK configuration for a Java/Kotlin plugin.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "compiler": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "java": {
                  "description": "Java compiler settings.",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "encoding": {
                      "description": "Encoding of source files.",
                      "type": "string",
                      "default": "UTF-8"
                    },
                    "release": {
                      "description": "Target Java release.",
                      "type": "integer",
                      "default": "8"
                    },
                    "source": {
                      "description": "Source bytecode level.",
                      "type": "integer",
                      "default": "8"
                    },
                    "target": {
                      "description": "Target bytecode level.",
                      "type": "integer",
                      "default": "8"
                    }
                  }
                },
                "kotlin": {
                  "description": "Kotlin compiler settings.",
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["version"],
                  "properties": {
                    "api_version": {
                      "description": "Kotlin API version.",
                      "type": "string"
                    },
                    "jvm_target": {
                      "description": "JVM bytecode target version",
                      "type": "string",
                      "default": "1.8"
                    },
                    "language_version": {
                      "description": "Kotlin version source compatibility.",
                      "type": "string",
                      "default": "8"
                    },
                    "version": {
                      "description": "Version of the Kotlin compiler",
                      "type": "string"
                    }
                  }
                }
              }
            },
            "deps": {
              "description": "Runtime dependencies of the generated Java/Kotlin code (in GAV format).",
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            },
            "additional_runtimes": {
              "description": "Configures additional supported runtimes.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["name"],
                "properties": {
                  "name": {
                    "description": "The name of the additional runtime. The only known name at this time is `lite` for Protobuf lite runtime support.",
                    "type": "string",
                    "const": "lite"
                  },
                  "deps": {
                    "description": "Dependencies for the runtime. These override `registry -> maven -> deps` if specified.",
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                      "type": "string"
                    }
                  },
                  "opts": {
                    "description": "Plugin options for the additional runtime.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "python": {
          "description": "Generated SDK configuration for a Python plugin.",
          "type": "object",
          "additionalProperties": false,
          "required": ["package_type"],
          "properties": {
            "deps": {
              "description": "Runtime dependencies of the generated code.",
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            },
            "requires_python": {
              "description": "Specifies the `Requires-Python` of the generated package.",
              "type": "string"
            },
            "package_type": {
              "description": "One of `runtime` or `stub-only`.",
              "type": "string",
              "enum": ["runtime", "stub-only"]
            }
          }
        },
        "swift": {
          "description": "Generated SDK configuration for a Swift plugin.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "deps": {
              "description": "Dependencies of the generated code.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "source": {
                    "description": "URL of the Swift package.",
                    "type": "string"
                  },
                  "package": {
                    "description": "Name of the Swift package.",
                    "type": "string"
                  },
                  "version": {
                    "description": "Version of the Swift package.",
                    "type": "string"
                  },
                  "products": {
                    "description": "Products to import.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "platforms": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "macos": {
                        "description": "Version of the macOS platform.",
                        "type": "string"
                      },
                      "ios": {
                        "description": "Version of the iOS platform.",
                        "type": "string"
                      },
                      "tvos": {
                        "description": "Version of the tvOS platform.",
                        "type": "string"
                      },
                      "watchos": {
                        "description": "Version of the watchOS platform.",
                        "type": "string"
                      }
                    }
                  },
                  "swift_versions": {
                    "description": "Versions of Swift the package supports.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "cargo": {
          "description": "Generated SDK configuration for a Rust plugin.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "rust_version": {
              "description": "The rust-version set for the generated crate.",
              "type": "string"
            },
            "deps": {
              "description": "Crates.io dependencies for the Generated SDK.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "description": "The name of the dependency.",
                    "type": "string"
                  },
                  "req": {
                    "description": "The version request of the dependency.",
                    "type": "string"
                  },
                  "default_features": {
                    "description": "Whether or not to enable default features for the dependency.",
                    "type": "boolean"
                  },
                  "features": {
                    "description": "The features to enable for the dependency.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "nuget": {
          "description": "Generated SDK configuration for a C# plugin.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "target_frameworks": {
              "description": "The target frameworks the generated package supports.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "deps": {
              "description": "nuget.org dependencies for the Generated SDK.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "description": "The package ID of the dependency.",
                    "type": "string"
                  },
                  "version": {
                    "description": "The version range of the dependency.",
                    "type": "string"
                  },
                  "target_frameworks": {
                    "description": "The target frameworks the dependency applies to.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "cmake": {
          "description": "Generated SDK configuration for a CMake plugin.",
          "type": "object",
          "additionalProperties": false
        }
      }
    }
  }
}
