{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/typeship-dev/json-schema/typeship-dev-create-project-request-schema.json",
  "title": "CreateProjectRequest",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/typeship-dev-openapi.json#/components/schemas/CreateProjectRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "name",
    "spec",
    "targets"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "spec": {
      "$ref": "#/$defs/SpecFields"
    },
    "targets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/InitialTargetFields"
      },
      "description": "Initial first-class Targets. More than one may use the same generator with different identities or Deliveries."
    },
    "auto_generate": {
      "type": "boolean",
      "default": true,
      "description": "Whether Typeship should regenerate automatically when the source or saved configuration changes."
    },
    "config": {
      "oneOf": [
        {
          "$ref": "#/$defs/ProjectConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Shared defaults inherited by every Target. GraphQL settings belong in spec.graphql."
    }
  },
  "$defs": {
    "AuthenticationConfig": {
      "type": "object",
      "additionalProperties": false,
      "description": "Public authentication defaults for generated clients and tools. Stored Projects own the OAuth server, application catalog, and identity policy; one-shot generation accepts the same shape for one run. Runtime credentials and client secrets are never accepted.",
      "properties": {
        "oauth_server": {
          "oneOf": [
            {
              "$ref": "#/$defs/OAuthServer"
            },
            {
              "type": "null"
            }
          ]
        },
        "oauth_applications": {
          "type": [
            "object",
            "null"
          ],
          "maxProperties": 20,
          "propertyNames": {
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "additionalProperties": {
            "$ref": "#/$defs/OAuthApplication"
          },
          "description": "OAuth applications keyed by a stable name."
        },
        "oauth_application": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9_-]{0,63}$",
          "description": "Default OAuth application used by generated products."
        },
        "identity_verification": {
          "oneOf": [
            {
              "$ref": "#/$defs/IdentityVerification"
            },
            {
              "type": "null"
            }
          ]
        },
        "approval_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Base URL of a custom browser-approval backend implementing the start, status, and revoke contract. Used only when OAuth is not configured."
        },
        "environments": {
          "type": [
            "object",
            "null"
          ],
          "maxProperties": 20,
          "propertyNames": {
            "pattern": "^[A-Za-z_$][A-Za-z0-9_$]{0,127}$"
          },
          "additionalProperties": {
            "$ref": "#/$defs/AuthenticationEnvironment"
          },
          "description": "Authentication selections keyed by generated API environment name."
        },
        "credential_variables": {
          "type": [
            "object",
            "null"
          ],
          "maxProperties": 20,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 200
          },
          "additionalProperties": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[A-Z_][A-Z0-9_]{0,127}$"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "username",
                  "password"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "pattern": "^[A-Z_][A-Z0-9_]{0,127}$"
                  },
                  "password": {
                    "type": "string",
                    "pattern": "^[A-Z_][A-Z0-9_]{0,127}$"
                  }
                }
              }
            ]
          },
          "description": "Environment variables the generated CLI, MCP server, and SDK environment fallbacks read, keyed by security scheme name. A string names the token or key variable; a Basic scheme takes { username, password }. Wins over the scheme's x-typeship-env extension. Without either, names derive from the package and scheme."
        },
        "credential_parameters": {
          "type": [
            "object",
            "null"
          ],
          "maxProperties": 200,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 500
          },
          "additionalProperties": {
            "type": "object",
            "maxProperties": 20,
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "description": "Whether a parameter carries the operation's credential, keyed by operationId, \"METHOD /path\", or \"*\" for every operation, then by the parameter's wire name. true leaves the parameter out of generated signatures, CLI flags, and MCP tool input, because the configured credential already reaches the API; false keeps it. Wins over the parameter's x-typeship-credential extension and the generator's inference."
        }
      }
    },
    "AuthenticationEnvironment": {
      "type": "object",
      "additionalProperties": false,
      "description": "OAuth application and request-value overrides for one named API environment.",
      "properties": {
        "oauth_application": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9_-]{0,63}$"
        },
        "scopes": {
          "type": [
            "array",
            "null"
          ],
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "pattern": "^\\S+$"
          }
        },
        "audience": {
          "type": [
            "string",
            "null"
          ]
        },
        "resource": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        }
      }
    },
    "CliBehavior": {
      "type": "object",
      "additionalProperties": false,
      "description": "How the generated CLI behaves. Part of Config.",
      "properties": {
        "command_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Command users run, independent of how the CLI is distributed."
        },
        "changelog_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Public HTTP(S) URL read by the optional changelog command in generated CLIs. Supports UTF-8 Markdown, plain text, and static HTML; embedded credentials are not allowed. Omit or clear to disable, then regenerate."
        },
        "support_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where the generated CLI's feedback command sends users. GitHub issues/new URLs get a prefilled title and environment details."
        },
        "mcp_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Fallback MCP endpoint used by the generated CLI when the Project has no Typeship-hosted MCP endpoint. A hosted endpoint takes precedence over this URL."
        },
        "skills_repo": {
          "type": [
            "string",
            "null"
          ],
          "description": "Repository in owner/name format that the generated CLI's init command offers for skill installation."
        }
      }
    },
    "DeliveryInput": {
      "oneOf": [
        {
          "$ref": "#/$defs/RepositoryDeliveryInput"
        },
        {
          "$ref": "#/$defs/HostedMcpDeliveryInput"
        }
      ]
    },
    "DiagnosticPolicy": {
      "type": "object",
      "additionalProperties": false,
      "description": "Source pull-request enforcement threshold, new-versus-complete baseline, and explicitly reviewed rule or location exceptions.",
      "required": [
        "fail_on",
        "only_new",
        "suppressions"
      ],
      "properties": {
        "fail_on": {
          "type": "string",
          "enum": [
            "never",
            "error",
            "warning"
          ],
          "default": "error",
          "description": "Severity threshold that fails the API change review check."
        },
        "only_new": {
          "type": "boolean",
          "default": true,
          "description": "Enforce only occurrences introduced by the proposed source change."
        },
        "suppressions": {
          "type": "array",
          "default": [],
          "maxItems": 100,
          "items": {
            "$ref": "#/$defs/DiagnosticSuppression"
          }
        }
      }
    },
    "DiagnosticSuppression": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "rule_id",
        "reason"
      ],
      "properties": {
        "rule_id": {
          "type": "string",
          "maxLength": 160
        },
        "path": {
          "type": "string",
          "maxLength": 4096,
          "description": "Exact schema coordinate. Omit only to suppress every occurrence of the rule."
        },
        "reason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "description": "The reviewed product decision behind this exception."
        }
      }
    },
    "GeneratorKind": {
      "type": "string",
      "enum": [
        "cli",
        "mcp",
        "typescript_sdk",
        "python_sdk",
        "go_sdk"
      ],
      "description": "Package type selected by a Target. Several Targets may use the same type. The CLI is a self-contained command-line package and requires no SDK Target."
    },
    "GraphqlSettings": {
      "type": "object",
      "additionalProperties": false,
      "description": "What a GraphQL schema cannot say about itself. Ignored for OpenAPI specs.",
      "if": {
        "required": [
          "auth"
        ],
        "properties": {
          "auth": {
            "enum": [
              "api_key",
              "api_key_or_bearer"
            ]
          }
        }
      },
      "then": {
        "required": [
          "api_key_header"
        ]
      },
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "description": "The URL every request is POSTed to; the generated client's default baseUrl. Defaults to the URL the schema was fetched from. Without either, baseUrl is a required client option."
        },
        "environments": {
          "type": "array",
          "maxItems": 10,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "url"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "description": "Named endpoints (sandbox, production). Each becomes a client environment; the first is the default unless endpoint is set."
        },
        "auth": {
          "type": "string",
          "enum": [
            "bearer",
            "basic",
            "basic_api_key",
            "api_key",
            "api_key_or_bearer",
            "none"
          ],
          "default": "bearer",
          "description": "How requests authenticate. bearer sends Authorization: Bearer; basic is for key-pair APIs (public key as username, private key as password); basic_api_key sends one API key as the Basic-auth username with an empty password; api_key sends a header named by api_key_header; api_key_or_bearer sends a key in api_key_header (Authorization for a raw key) and also accepts an OAuth access token as Authorization: Bearer; none generates no auth option."
        },
        "api_key_header": {
          "type": "string",
          "description": "Header carrying the key when auth is api_key or api_key_or_bearer. Required for those modes; Typeship does not invent a vendor-specific header name."
        },
        "title": {
          "type": "string",
          "maxLength": 80,
          "description": "The API's name; drives the package and client names (\"Acme\" gives acme and AcmeClient). Defaults to a name derived from the endpoint's host."
        },
        "scalars": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "type": "string",
            "enum": [
              "string",
              "integer",
              "number",
              "boolean",
              "json"
            ]
          },
          "description": "JSON representation of each custom scalar, keyed by GraphQL scalar name. Unmapped scalars generate as the language's untyped JSON value and produce a warning. Unmatched keys warn."
        },
        "error_types": {
          "type": "array",
          "maxItems": 100,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[_A-Za-z][_0-9A-Za-z]*$"
          },
          "description": "Object types that report a failure when an operation's union or interface result resolves to them (errors returned as data). Replaces the default, which is every member whose name ends in Error when the result can also be something else. An empty array treats no result as a failure. Names that are not object types in the schema produce a generation warning."
        },
        "page_size": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 100,
          "description": "Page size a paginated connection call sends as first when the caller passes neither first nor last. Relay servers such as GitHub reject a connection query without one. Ignored for a connection whose first argument has a schema default."
        }
      }
    },
    "HostedMcpDeliveryInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "hosted_mcp"
        }
      }
    },
    "IdentityVerification": {
      "description": "Authenticated identity read used to verify a login before it is saved. Operation is auto-detected when omitted or null. At least one of subject_field, account_field, or organization_field must be a non-null JSON Pointer. Null clears an individual mapping while another remains. Set identity_verification itself to null to remove the whole policy.",
      "allOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "operation": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 2000,
              "pattern": "^[\\w$]+\\.[\\w$]+$",
              "description": "resource.method of a safe identity read with no required arguments."
            },
            "subject_field": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 512,
              "pattern": "^/(?:[^~\\x00-\\x1f\\x7f]|~[01])*$",
              "description": "JSON Pointer to the stable caller ID in the identity response."
            },
            "account_field": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 512,
              "pattern": "^/(?:[^~\\x00-\\x1f\\x7f]|~[01])*$",
              "description": "JSON Pointer to the customer account ID."
            },
            "organization_field": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 512,
              "pattern": "^/(?:[^~\\x00-\\x1f\\x7f]|~[01])*$",
              "description": "JSON Pointer to the customer organization ID."
            }
          }
        },
        {
          "anyOf": [
            {
              "required": [
                "subject_field"
              ],
              "properties": {
                "subject_field": {
                  "type": "string"
                }
              }
            },
            {
              "required": [
                "account_field"
              ],
              "properties": {
                "account_field": {
                  "type": "string"
                }
              }
            },
            {
              "required": [
                "organization_field"
              ],
              "properties": {
                "organization_field": {
                  "type": "string"
                }
              }
            }
          ]
        }
      ]
    },
    "InitialTargetFields": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "type": {
          "$ref": "#/$defs/GeneratorKind"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "disabled"
          ],
          "default": "active"
        },
        "release_channel": {
          "type": "string",
          "enum": [
            "stable",
            "prerelease"
          ],
          "default": "stable"
        },
        "checks": {
          "$ref": "#/$defs/TargetChecks"
        },
        "config": {
          "oneOf": [
            {
              "$ref": "#/$defs/TargetConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Target-specific overrides merged over Project.config. GraphQL settings are rejected here and belong to the Spec."
        },
        "deliveries": {
          "type": "array",
          "maxItems": 2,
          "items": {
            "$ref": "#/$defs/DeliveryInput"
          }
        }
      }
    },
    "McpBehavior": {
      "type": "object",
      "additionalProperties": false,
      "description": "How generated MCP servers and the Typeship-hosted endpoint behave. Part of Config.",
      "properties": {
        "registry_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Stable official MCP registry name, independent of the server runtime."
        },
        "access": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "issuer",
            "resource"
          ],
          "description": "Authorization for callers connecting to a generated MCP server deployed over HTTP. The hosting application resolves upstream API credentials separately at runtime. This setting does not apply to the Typeship-hosted endpoint.",
          "properties": {
            "issuer": {
              "type": "string",
              "format": "uri",
              "description": "Exact issuer allowed to sign MCP connection tokens."
            },
            "resource": {
              "type": "string",
              "format": "uri",
              "description": "Canonical public URL of the self-hosted MCP endpoint that connection tokens must target."
            },
            "jwks_url": {
              "type": "string",
              "format": "uri",
              "description": "Public signing-key endpoint. Omit to discover it from the issuer."
            },
            "scopes": {
              "type": "array",
              "maxItems": 20,
              "items": {
                "type": "string"
              },
              "description": "Minimum scopes required to connect to the self-hosted MCP server."
            }
          }
        },
        "tool_mode": {
          "type": "string",
          "enum": [
            "auto",
            "operations",
            "meta"
          ],
          "description": "MCP tool shape. meta collapses per-operation tools into search_docs, read_docs, and execute so large APIs don't flood an agent's context window. Auto considers the serialized tool schemas, switching near 10k tokens or above 100 operations."
        },
        "instructions": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 2000,
          "description": "Guidance appended to the MCP server's instructions, which agents read once when they connect (server/discover): what to call first, conventions the spec does not state, what not to do. Carried by the package's server and the hosted endpoint alike."
        },
        "tool_descriptions": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "maxLength": 600
          },
          "maxProperties": 200,
          "description": "Hand-written MCP tool descriptions keyed by operationId or \"METHOD /path\". Each replaces the text typeship derives for that operation (summary, first sentence, method and path, deprecation and auth notes). For flows the spec cannot describe, such as a multi-step upload. Keys that match no operation are reported as generation warnings."
        },
        "reference_resolvers": {
          "type": "object",
          "maxProperties": 200,
          "description": "Exact name-or-ID resolver overrides keyed first by the target operationId or \"METHOD /path\", then by its wire argument name. A resolver names one read collection operation plus 1-4 item fields to match case-insensitively; false opts that argument out of strict inference.",
          "additionalProperties": {
            "type": "object",
            "maxProperties": 20,
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "boolean",
                  "enum": [
                    false
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "via",
                    "match"
                  ],
                  "properties": {
                    "via": {
                      "type": "string",
                      "maxLength": 200,
                      "description": "OperationId, \"METHOD /path\", MCP tool name, or dotted resource.method of the list operation."
                    },
                    "match": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 4,
                      "uniqueItems": true,
                      "items": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "description": "Item fields compared exactly and case-insensitively, such as name, slug, key, or email."
                    },
                    "id": {
                      "type": "string",
                      "maxLength": 100,
                      "description": "Item field substituted into the requested argument. Defaults to id."
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "OAuthApplication": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "client_id"
      ],
      "description": "OAuth application available to generated products. Public clients support interactive login; confidential clients support runtime-supplied machine credentials. Client secrets are never stored.",
      "properties": {
        "client_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "OAuth client identifier."
        },
        "login_method": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "browser",
            "device",
            null
          ],
          "description": "Interactive login method. Browser login uses Authorization Code with PKCE."
        },
        "client_auth_method": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "post",
            "basic",
            null
          ],
          "description": "How a runtime-supplied client secret is sent for machine grants."
        },
        "redirect_uri": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Loopback callback URL for browser login."
        },
        "organization_parameter": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "organization",
            "organization_id",
            null
          ],
          "description": "Provider parameter used to request an organization during browser login."
        }
      }
    },
    "OAuthServer": {
      "type": "object",
      "additionalProperties": false,
      "description": "Authorization-server metadata used by generated OAuth flows. Secrets and runtime credentials are never accepted here.",
      "properties": {
        "issuer": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Exact authorization-server issuer, including any tenant path."
        },
        "discovery_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Exact metadata URL when it cannot be derived from the issuer."
        },
        "authorization_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Authorization endpoint override."
        },
        "token_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Token endpoint override."
        },
        "device_authorization_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Device-authorization endpoint override."
        },
        "scopes": {
          "type": [
            "array",
            "null"
          ],
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "pattern": "^\\S+$"
          },
          "description": "Default scopes requested during login."
        },
        "audience": {
          "type": [
            "string",
            "null"
          ],
          "description": "Default audience included in authorization and token requests."
        },
        "resource": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Protected API resource included in authorization and token requests."
        }
      }
    },
    "PackageBehavior": {
      "type": "object",
      "additionalProperties": false,
      "description": "Published-package metadata the API spec does not own. Repository is derived from each destination.",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 100,
          "description": "The API's name as generated READMEs, AGENTS.md, package descriptions, and help text show it, such as \"Parcel\" for a Spec titled \"Parcel - Public API\". Display only: package, client, and command names still come from the Spec. Defaults to the Spec title with common noise removed (\"Parcel - API\" shows as Parcel)."
        },
        "homepage": {
          "type": [
            "string",
            "null"
          ],
          "description": "Homepage written into registry metadata."
        },
        "license": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "SPDX identifier written into registry metadata. Defaults to info.license."
        },
        "license_text": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 100000,
          "description": "Exact LICENSE file contents. Supply this for licences the engine does not build in; MIT is built in when copyright is also set."
        },
        "copyright": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "Copyright line used in generated license files."
        },
        "go_package_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Go identifier when the destination repository name is unsuitable."
        }
      }
    },
    "PaginationRule": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "items_field"
      ],
      "properties": {
        "style": {
          "type": "string",
          "enum": [
            "cursor",
            "cursor_from_last_id",
            "page",
            "offset"
          ],
          "default": "cursor"
        },
        "items_field": {
          "type": "string",
          "description": "Response field holding the item array."
        },
        "cursor_param": {
          "type": "string"
        },
        "next_cursor_field": {
          "type": "string"
        },
        "has_more_field": {
          "type": "string"
        },
        "id_field": {
          "type": "string"
        },
        "page_param": {
          "type": "string"
        },
        "offset_param": {
          "type": "string"
        },
        "limit_param": {
          "type": "string"
        }
      }
    },
    "ProjectConfig": {
      "type": "object",
      "additionalProperties": false,
      "description": "Shared generated-client and tooling behavior for a stored Project. Every Target inherits these defaults. Target.config is merged over them for one Target; top-level values replace defaults while cli, mcp, auth, readme, and package merge by field. GraphQL-only source settings live on the Project's Spec and are rejected in both stored config scopes.",
      "properties": {
        "globals": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxItems": 20,
          "description": "Wire names of query/header parameters that become settable once on the generated client and auto-apply to every operation that accepts them; per-call values win. Names that match nothing are reported as generation warnings."
        },
        "include": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": "Generate only matching operations: tag names, or path globs such as `/zones/**` (`*` is one path segment, `**` any number), optionally after an HTTP method (`DELETE /zones/*`). Applied before the Spec size limit, with components nothing references any more removed, so a one-shot run can generate part of a Spec up to 64 MB. Selectors that match nothing are reported as generation warnings."
        },
        "exclude": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": "Leave out matching operations (tag names or path globs, as for `include`). Wins over `include`."
        },
        "retries": {
          "$ref": "#/$defs/RetryTuning"
        },
        "pagination": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "oneOf": [
              {
                "$ref": "#/$defs/PaginationRule"
              },
              {
                "type": "boolean",
                "description": "false disables pagination detection for the operation."
              }
            ]
          },
          "description": "Per-operation pagination control, keyed by operationId or \"METHOD /path\". Unmatched keys are reported as generation warnings."
        },
        "auth": {
          "$ref": "#/$defs/AuthenticationConfig"
        },
        "cli": {
          "$ref": "#/$defs/CliBehavior"
        },
        "mcp": {
          "$ref": "#/$defs/McpBehavior"
        },
        "readme": {
          "$ref": "#/$defs/ReadmeBehavior"
        },
        "package": {
          "$ref": "#/$defs/PackageBehavior"
        },
        "docs_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "The API's documentation site. Read through its llms.txt by the generated CLI's docs command, the MCP server's docs tools, and the package's AGENTS.md. Defaults to the Spec's externalDocs URL."
        },
        "docs_index_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Exact llms.txt URL when the documentation site does not publish it at docs_url + /llms.txt."
        }
      }
    },
    "ReadmeBehavior": {
      "type": "object",
      "additionalProperties": false,
      "description": "Generated README behavior. Part of Config.",
      "properties": {
        "quickstart_operation": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500,
          "description": "operationId or \"METHOD /path\" to feature as the README's first API call. It must be present in the generated package and callable with no required input beyond path placeholders. Missing or unsuitable choices produce a warning and use the automatic example."
        }
      }
    },
    "RepositoryDeliveryInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "repository"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "repository"
        },
        "repository": {
          "$ref": "#/$defs/RepositoryDeliverySettingsInput"
        }
      }
    },
    "RepositoryDeliverySettingsInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "provider",
        "identifier"
      ],
      "properties": {
        "provider": {
          "$ref": "#/$defs/RepositoryProvider"
        },
        "identifier": {
          "$ref": "#/$defs/RepositoryIdentifier"
        },
        "directory": {
          "type": [
            "string",
            "null"
          ]
        },
        "package_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "npm or Python registry identity where applicable."
        },
        "module_path": {
          "type": [
            "string",
            "null"
          ],
          "description": "Go module identity for the Go SDK or CLI Target where applicable."
        },
        "publish_on_merge": {
          "type": "boolean",
          "default": false,
          "description": "Commit repository-owned registry automation and report publication after the Draft merges."
        }
      }
    },
    "RepositoryIdentifier": {
      "type": "string",
      "maxLength": 512,
      "description": "Provider-native repository identity, opaque outside its adapter."
    },
    "RepositoryProvider": {
      "type": "string",
      "enum": [
        "github"
      ],
      "description": "GitHub is the only launch provider; the field is stable for future adapters."
    },
    "RepositorySpecSourceInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "repository"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "repository"
        },
        "repository": {
          "$ref": "#/$defs/RepositorySpecSourceSettingsInput"
        }
      }
    },
    "RepositorySpecSourceSettingsInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "provider",
        "identifier",
        "path"
      ],
      "properties": {
        "provider": {
          "$ref": "#/$defs/RepositoryProvider"
        },
        "identifier": {
          "$ref": "#/$defs/RepositoryIdentifier"
        },
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096,
          "pattern": "^(?!/)(?!.*\\.\\.).+$",
          "description": "Repository-relative Spec entrypoint."
        }
      }
    },
    "RetryTuning": {
      "type": "object",
      "additionalProperties": false,
      "description": "Retry behavior. Top-level fields adjust every operation; operations maps operationId or \"METHOD /path\" keys to per-operation overrides.",
      "properties": {
        "max_retries": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "statuses": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "maxItems": 20,
          "description": "Replaces the default retryable set (408, 429, 500, 502, 503, 504)."
        },
        "initial_delay_ms": {
          "type": "integer",
          "minimum": 1
        },
        "max_delay_ms": {
          "type": "integer",
          "minimum": 1
        },
        "retry_non_idempotent": {
          "type": "boolean",
          "description": "Also retry non-idempotent methods (POST/PATCH)."
        },
        "disabled": {
          "type": "boolean",
          "description": "Shorthand for max_retries 0."
        },
        "operations": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "$ref": "#/$defs/RetryTuning"
          }
        }
      }
    },
    "SpecFields": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source"
      ],
      "properties": {
        "source": {
          "$ref": "#/$defs/SpecSourceInput"
        },
        "patches": {
          "type": "array",
          "maxItems": 50,
          "items": {
            "$ref": "#/$defs/SpecPatch"
          },
          "default": []
        },
        "graphql": {
          "oneOf": [
            {
              "$ref": "#/$defs/GraphqlSettings"
            },
            {
              "type": "null"
            }
          ],
          "description": "GraphQL-only endpoint, auth, environment, title, and scalar settings."
        },
        "diagnostic_policy": {
          "$ref": "#/$defs/DiagnosticPolicy"
        }
      }
    },
    "SpecPatch": {
      "type": "object",
      "additionalProperties": false,
      "description": "A fix applied to the resolved Spec before generation. Paths are JSON\nPointers into the document. A patch whose target no longer exists is\nskipped and reported as a warning on the generation, never silently.\n",
      "required": [
        "op",
        "path"
      ],
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "set",
            "append",
            "remove",
            "rename"
          ]
        },
        "path": {
          "type": "string",
          "description": "JSON-Pointer-style path. Pattern segments enable bulk fixes:\n* (any child), ** (any depth), [key=value] (filter), e.g.\n/paths/**/parameters/[name=account_id]/schema/type. Renaming a\nschema under /components/schemas also rewrites its $refs.\n"
        },
        "value": {
          "description": "set only; the replacement value."
        },
        "to": {
          "type": [
            "string",
            "null"
          ],
          "description": "rename only; the new key name."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "SpecSourceInput": {
      "oneOf": [
        {
          "$ref": "#/$defs/UrlSpecSourceInput"
        },
        {
          "$ref": "#/$defs/RepositorySpecSourceInput"
        }
      ]
    },
    "TargetAuthenticationConfig": {
      "type": "object",
      "additionalProperties": false,
      "description": "Selects a Project OAuth application for one Target. OAuth server metadata, applications, and identity policy remain Project-owned.",
      "properties": {
        "oauth_application": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9_-]{0,63}$",
          "description": "Project OAuth application to use. Omit to inherit the Project default."
        },
        "environments": {
          "type": [
            "object",
            "null"
          ],
          "maxProperties": 20,
          "propertyNames": {
            "pattern": "^[A-Za-z_$][A-Za-z0-9_$]{0,127}$"
          },
          "additionalProperties": {
            "$ref": "#/$defs/TargetAuthenticationEnvironment"
          },
          "description": "Project OAuth application selections keyed by API environment."
        }
      }
    },
    "TargetAuthenticationEnvironment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "oauth_application": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9_-]{0,63}$"
        }
      }
    },
    "TargetChecks": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "generated": {
          "type": "array",
          "uniqueItems": true,
          "default": [
            "build",
            "package",
            "public_entrypoint"
          ],
          "items": {
            "type": "string",
            "enum": [
              "build",
              "package",
              "public_entrypoint"
            ]
          }
        },
        "repository_required": {
          "type": "array",
          "maxItems": 50,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        },
        "customer": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "command"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "command": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            }
          }
        }
      },
      "description": "Required checks run against the code in the Draft. Generated checks and customer commands share one reproducible workflow; repository_required names existing repository checks. Supplying checks replaces all settings. Omitted generated restores build, package, and public_entrypoint; omitted repository_required and customer restore empty lists. An empty object restores these defaults. An empty array clears the corresponding list."
    },
    "TargetCliBehavior": {
      "type": "object",
      "additionalProperties": false,
      "description": "How the generated CLI behaves. Part of Config.",
      "properties": {
        "command_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Command users run, independent of how the CLI is distributed."
        },
        "changelog_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Public HTTP(S) URL read by the optional changelog command in generated CLIs. Supports UTF-8 Markdown, plain text, and static HTML; embedded credentials are not allowed. Omit or clear to disable, then regenerate."
        },
        "support_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where the generated CLI's feedback command sends users. GitHub issues/new URLs get a prefilled title and environment details."
        },
        "mcp_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Fallback MCP endpoint used by the generated CLI when the Project has no Typeship-hosted MCP endpoint. A hosted endpoint takes precedence over this URL."
        },
        "skills_repo": {
          "type": [
            "string",
            "null"
          ],
          "description": "Repository in owner/name format that the generated CLI's init command offers for skill installation."
        },
        "relay": {
          "type": "boolean",
          "description": "Enable webhook relay sessions for this CLI Target. Requires Pro. Turning it off prevents new sessions."
        },
        "unit_tests": {
          "type": "boolean",
          "description": "Also generate unit tests for the helper code a CLI shares, such as raw API path checks, saved credentials, and MCP client configuration. Applies to cli Targets. Off by default; tests for the generated commands are always included."
        }
      }
    },
    "TargetConfig": {
      "type": "object",
      "additionalProperties": false,
      "description": "Target-specific generation and delivery overrides. Authentication may only select a Project-owned OAuth application. OAuth server metadata, applications, and identity policy remain Project-owned. Self-hosted MCP access may be overridden for a Target-specific deployment.",
      "properties": {
        "globals": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxItems": 20,
          "description": "Wire names of query/header parameters that become settable once on the generated client and auto-apply to every operation that accepts them; per-call values win. Names that match nothing are reported as generation warnings."
        },
        "include": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": "Generate only matching operations: tag names, or path globs such as `/zones/**` (`*` is one path segment, `**` any number), optionally after an HTTP method (`DELETE /zones/*`). Applied before the Spec size limit, with components nothing references any more removed, so a one-shot run can generate part of a Spec up to 64 MB. Selectors that match nothing are reported as generation warnings."
        },
        "exclude": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": "Leave out matching operations (tag names or path globs, as for `include`). Wins over `include`."
        },
        "retries": {
          "$ref": "#/$defs/RetryTuning"
        },
        "pagination": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "oneOf": [
              {
                "$ref": "#/$defs/PaginationRule"
              },
              {
                "type": "boolean",
                "description": "false disables pagination detection for the operation."
              }
            ]
          },
          "description": "Per-operation pagination control, keyed by operationId or \"METHOD /path\". Unmatched keys are reported as generation warnings."
        },
        "auth": {
          "$ref": "#/$defs/TargetAuthenticationConfig"
        },
        "cli": {
          "$ref": "#/$defs/TargetCliBehavior"
        },
        "mcp": {
          "$ref": "#/$defs/McpBehavior"
        },
        "readme": {
          "$ref": "#/$defs/ReadmeBehavior"
        },
        "package": {
          "$ref": "#/$defs/PackageBehavior"
        },
        "docs_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "The API's documentation site. Read through its llms.txt by the generated CLI's docs command, the MCP server's docs tools, and the package's AGENTS.md. Defaults to the Spec's externalDocs URL."
        },
        "docs_index_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Exact llms.txt URL when the documentation site does not publish it at docs_url + /llms.txt."
        }
      }
    },
    "UrlSpecSourceInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "url"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "url"
        },
        "url": {
          "$ref": "#/$defs/UrlSpecSourceSettingsInput"
        }
      }
    },
    "UrlSpecSourceSettingsInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "maxLength": 2048,
          "pattern": "^https?://",
          "description": "URL of an OpenAPI document, GraphQL SDL file, or GraphQL endpoint."
        },
        "headers": {
          "oneOf": [
            {
              "type": "object",
              "maxProperties": 20,
              "additionalProperties": {
                "type": "string",
                "maxLength": 4096
              }
            },
            {
              "type": "null"
            }
          ],
          "writeOnly": true,
          "description": "Request headers for a protected URL. Values are never returned or recorded in revision history. When updating the same URL, omit headers to preserve the stored values or pass null to remove them. Changing the URL without headers clears the old values so a credential is never forwarded to a different source."
        }
      }
    }
  }
}