Skip to content

publish form: per-method HTTP param resolution (query/path/path_raw/body/header)#54

Merged
TeoSlayer merged 1 commit into
mainfrom
feat/publish-form-param-resolve
Jun 26, 2026
Merged

publish form: per-method HTTP param resolution (query/path/path_raw/body/header)#54
TeoSlayer merged 1 commit into
mainfrom
feat/publish-form-param-resolve

Conversation

@Alexgodoroja

Copy link
Copy Markdown
Collaborator

What

Extends the Publish an app wizard (src/pages/publish.astro, the Methods step) so that for each HTTP-backend method, publishers can specify the full request mapping — not just a verb and path, but where every parameter is resolved from when the adapter calls the backend.

Changes (HTTP-backend methods only — CLI path untouched)

Per method:

  • Verb — expanded from GET | POST to GET | POST | PUT | PATCH | DELETE.
  • Path — a path-template string that may contain {name} placeholders, with updated helper text.

Per parameter, a new In column with a resolution selector:

value meaning
query ?name=value (url-encoded). Default for GET.
path fills {name} in the path, url-encoded (REST).
path_raw fills {name} in the path unescaped — for URL-in-path APIs (e.g. a fetch/proxy taking GET /<rawurl>).
body JSON body field. Default for POST/PUT/PATCH.
header sent as a request header.

Each option carries a one-line explanation (option title + column tooltip).

Easy to configure (zero extra clicks for simple forms)

A param with no explicit in resolves to the verb's natural location at submit time — GET/DELETEquery, POST/PUT/PATCHbody — shown as (default) in the dropdown. Existing simple forms keep working unchanged.

Submission shape alignment

submission() now emits "in": "<value>" on every HTTP param and the method's http: {verb, path}, matching the app-template submission shape exactly (submissions/<id>/case.json). CLI params are unchanged and emit no in.

Validation, preview & mirrors

  • path / path_raw are only meaningful when the param name appears as {name} in the path template. The UI shows an inline hint (Add {name} to the path…) and client-side validation blocks submit until it does.
  • The live preview and the Review table both reflect the new verb/path and per-param mapping (e.g. url→path_raw).
  • The /plain/publish text mirror is updated to describe the new mapping.

Validation done

  • npx astro build — 190 pages, no errors.
  • Bundled form JS passes node --check; verbs + path_raw + p-in present in the built bundle and CSS.
  • Drove the live preview through the wizard to the Methods step: verb dropdown shows all 5 verbs, the In column shows query (default) | path | path_raw | body | header, the {name} hint correctly appears/disappears as the path template changes.

Screenshot — new per-method / per-param UI

HTTP method card with the Verb dropdown, {url} path template, and the per-param In selector set to path_raw:

(captured locally — fetch.get method, url param mapped to path_raw)

…ody/header)

For HTTP-backend methods, publishers can now set the full request mapping:
- verb: GET | POST | PUT | PATCH | DELETE (was just GET/POST)
- path: a path template that may contain {name} placeholders, with helper text
- per param: an 'in' resolution selector — query | path | path_raw | body | header,
  each with a one-line explanation in the option title and the column tooltip.

Defaults keep simple forms zero-click: a param with no explicit 'in' resolves to
the verb's natural location (GET/DELETE -> query, POST/PUT/PATCH -> body), shown
as '(default)' in the dropdown. submission() emits 'in' on every HTTP param and the
method's http {verb, path}, matching the app-template submission shape exactly;
CLI-backend params are unchanged and emit no 'in'.

path / path_raw are only meaningful when the param name appears as {name} in the
path template — the UI shows an inline hint and client-side validation blocks
submit until it does. Live preview, the review table, and the /plain mirror all
reflect the new verb/path and per-param mapping.
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed to Cloudflare Pages

  • Commit deploy URL: https://0c1a12b5.pilotprotocol.pages.dev
  • Branch alias: https://feat/publish-form-param-resolve.pilotprotocol.pages.dev (may take ~30s to propagate)
  • Commit: 83d47950906d070abffee2b257dcdb190ea5d10c

@TeoSlayer TeoSlayer merged commit f35dd32 into main Jun 26, 2026
2 checks passed
@matthew-pilot matthew-pilot deleted the feat/publish-form-param-resolve branch June 27, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants