generate_line_draft
Generate a draft endpoint under a line from a sample inbound request and a description of the target: infers the inbound body schema from the sample, reads the target's method/URL/fields from an OpenAPI document (targetDocument) or a bare sample plus targetUrl, and proposes an outgoingMapping pairing every target field to a same-named inbound field. Nothing is guessed — a target field with no same-named match is reported in the "unmapped" list instead of being mapped, and every field it did map carries "inferred": true in the stored mapping tree. Always writes a draft (never publishes); the draft flows through preview_line_draft, dry_run_endpoint, config_diff and publish_line_draft like any other. Requires edit access.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sample | Yes | A sample inbound request body, shaped as one a real caller would send — one JSON field per key. | |
| lineKey | Yes | The line key to draft the generated endpoint under. | |
| targetUrl | No | The target URL. Required when targetSample is used; ignored when targetDocument is used (its servers[] entry wins). | |
| deliveryMode | Yes | The caller contract this endpoint offers: async acceptance with later outcomes, one sync reply, or a stream. | |
| targetSample | No | A raw sample of the target's own request body, used instead of targetDocument when there is no spec to read. Requires targetUrl. | |
| draftRevision | Yes | The line's current draft revision (0 for a line with no draft yet) — see get_line_draft. | |
| targetDocument | No | The target's OpenAPI 3.x document (YAML or JSON). Mutually exclusive with targetSample; must describe exactly one operation. | |
| targetFilename | No | Filename hint for targetDocument, to decide YAML vs JSON. Defaults to "target.json". | |
| targetHttpMethod | No | HTTP method for the target when using targetSample. Defaults to POST. |