{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pipeshub/json-schema/pipeshub-oauth-scopes-grouped-response-schema.json",
  "title": "OAuthScopesGroupedResponse",
  "description": "OAuth scopes available to the signed-in user for app registration, grouped by category label.\nCategory keys are UI labels (e.g. `Identity`, `Knowledge Base`); each maps to a list of scopes in that group.\nCategories defined in server config may appear with an **empty array** when every scope in that category is restricted for the caller's role (e.g. non–org-admin users never receive admin-only scopes).\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pipeshub-oauth-apps-api-openapi.yml#/components/schemas/OAuthScopesGroupedResponse",
  "type": "object",
  "properties": {
    "scopes": {
      "type": "object",
      "description": "Map of category display name to scopes in that category",
      "additionalProperties": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/OAuthScopeInfo"
        }
      }
    }
  },
  "required": [
    "scopes"
  ],
  "$defs": {
    "OAuthScopeInfo": {
      "type": "object",
      "description": "Information about an OAuth scope",
      "properties": {
        "name": {
          "type": "string",
          "description": "Scope identifier"
        },
        "description": {
          "type": "string",
          "description": "Human-readable scope description"
        },
        "category": {
          "type": "string",
          "description": "Scope category for grouping (matches the key under `scopes` on list responses)"
        },
        "requiresUserConsent": {
          "type": "boolean",
          "description": "Whether end-user consent is required when this scope is requested"
        }
      },
      "required": [
        "name",
        "description",
        "category",
        "requiresUserConsent"
      ]
    }
  }
}