{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pipeshub/json-schema/pipeshub-create-oauth-app-request-schema.json",
  "title": "CreateOAuthAppRequest",
  "description": "Request to create a new OAuth app (`createAppSchema` in `oauth.validators.ts`).\n\n**Required:** `name`, `allowedScopes`. **Optional:** `description`, `redirectUris`, `allowedGrantTypes`,\n`homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`, `isConfidential`, `accessTokenLifetime`, `refreshTokenLifetime`.\n\n**Redirect rule (Zod refine):** If the effective grant list includes `authorization_code`\n(including when `allowedGrantTypes` is omitted — defaults to `authorization_code` + `refresh_token`),\nat least one redirect URI is required. If grants exclude `authorization_code`, `redirectUris` may be omitted.\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/CreateOAuthAppRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "App name (displayed to users during authorization)",
      "minLength": 1,
      "maxLength": 100
    },
    "description": {
      "type": "string",
      "description": "App description",
      "maxLength": 500
    },
    "redirectUris": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      },
      "description": "Allowed redirect URIs (max 10). Required when an effective grant list includes `authorization_code`\n(including the default when `allowedGrantTypes` is omitted).\n",
      "maxItems": 10
    },
    "allowedGrantTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "authorization_code",
          "client_credentials",
          "refresh_token"
        ]
      },
      "description": "Allowed grant types. Defaults to `[\"authorization_code\", \"refresh_token\"]` if omitted (applied by the service, not Zod).\n"
    },
    "allowedScopes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Scopes the app can request (non-empty)",
      "minItems": 1
    },
    "homepageUrl": {
      "type": "string",
      "format": "uri",
      "description": "App homepage URL (shown during authorization)"
    },
    "privacyPolicyUrl": {
      "type": "string",
      "format": "uri",
      "description": "Privacy policy URL"
    },
    "termsOfServiceUrl": {
      "type": "string",
      "format": "uri",
      "description": "Terms of service URL"
    },
    "isConfidential": {
      "type": "boolean",
      "description": "Whether the app can securely store secrets.\n- `true`: Server-side app (secret required for token requests)\n- `false`: Browser/mobile app (must use PKCE)\n",
      "default": true
    },
    "accessTokenLifetime": {
      "type": "integer",
      "description": "Access token lifetime in seconds (300–86400)",
      "minimum": 300,
      "maximum": 86400,
      "default": 3600
    },
    "refreshTokenLifetime": {
      "type": "integer",
      "description": "Refresh token lifetime in seconds (3600–31536000)",
      "minimum": 3600,
      "maximum": 31536000,
      "default": 2592000
    }
  },
  "required": [
    "name",
    "allowedScopes"
  ]
}