{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://unpkg.com/@squiz/dx-json-schema-lib@latest/lib/manifest/userApiManifest/UserApiManifestV1.json",
    "title": "UserApiManifestV1",
    "type": "object",
    "additionalProperties": false,
    "definitions": {
        "resolvedApiManifest": {
            "type": "object",
            "additionalProperties": false,
            "required": ["endpoints"],
            "properties": {
                "endpoints": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["path", "method", "handler"],
                        "properties": {
                            "path": {
                                "type": "string",
                                "pattern": "^/.*",
                                "description": "URL path routed to this endpoint; must start with /. May include `*` wildcards or `:param` segments (api-builder style)."
                            },
                            "method": {
                                "type": "string",
                                "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"],
                                "description": "HTTP method for this route."
                            },
                            "handler": {
                                "type": "string",
                                "pattern": "^[a-zA-Z_$][a-zA-Z0-9_$.]*$",
                                "description": "Exported handler reference (module.export form)."
                            },
                            "description": {
                                "type": "string",
                                "description": "Description of the endpoint."
                            }
                        }
                    }
                }
            }
        }
    },
    "required": ["$schema", "name", "displayName", "filesDir", "entry", "manifest"],
    "properties": {
        "$schema": {
            "type": "string",
            "minLength": 1,
            "description": "JSON Schema reference for IDE support."
        },
        "name": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[a-z](?:[a-z0-9-]|_(?!_))*[a-z0-9]$",
            "description": "Slug for this deployment. Lowercase letters, digits, hyphens, or underscores only; must start with a letter, end with a letter or digit, and cannot contain consecutive underscores."
        },
        "displayName": {
            "type": "string",
            "minLength": 1
        },
        "description": {
            "type": "string",
            "description": "Human-readable summary of what the API provides."
        },
        "filesDir": {
            "type": "string",
            "minLength": 1,
            "description": "Directory (relative to the manifest) containing sources."
        },
        "entry": {
            "type": "string",
            "minLength": 1,
            "description": "Entry module path under filesDir (e.g. index.ts)."
        },
        "manifest": {
            "$ref": "#/definitions/resolvedApiManifest"
        }
    }
}
