Skip to content

feat: enable form submission without schema#12

Merged
RobertBoes merged 6 commits intomainfrom
feature/submit-without-schema
Apr 3, 2026
Merged

feat: enable form submission without schema#12
RobertBoes merged 6 commits intomainfrom
feature/submit-without-schema

Conversation

@RobertBoes
Copy link
Copy Markdown
Contributor

Summary

  • publicKey is now optional on createForm — when omitted, submit() constructs the URL from formId and the API base URL (https://formrelay.app/api/v1/form/{formId})
  • New optional botProtection and honeypotField options on createForm, useFormRelay, and both <FormRelay> components for SDK-managed bot protection and honeypot without a schema fetch
  • Users who handle bot protection and honeypot manually can omit these options and include the fields directly in form values

Usage

<!-- Full manual form with SDK-managed bot protection -->
<FormRelay
  form-id="contact"
  :bot-protection="{ type: 'turnstile', siteKey: '0x-key' }"
  honeypot-field="_hp_phone"
>
  <template #default="{ values, errors, submit, canSubmit }">
    <form @submit.prevent="submit">
      <input v-model="values.email" type="email" />
      <button :disabled="!canSubmit" type="submit">Send</button>
    </form>
  </template>
</FormRelay>

Test plan

  • Core: submitForm accepts SubmitConfig instead of full FormSchema (2 new tests)
  • Core: createForm submits without publicKey using constructed URL (3 new tests)
  • Core: schema values take precedence over options when both exist
  • Vue: composable submits without schema when no publicKey provided
  • Vue: canSubmit respects options.botProtection without schema
  • Vue: component submits without publicKey
  • All 138 tests pass (79 core + 59 vue)
  • Build succeeds for all packages

…chema

submitForm now accepts FormSchema | SubmitConfig as its second argument.
SubmitConfig only requires submitUrl, with optional honeypotField and
botProtection. This enables submission without fetching the schema.
Make publicKey optional on FormClientOptions; when absent, submit() constructs
a SubmitConfig from formId + API_BASE_URL plus the new botProtection/honeypotField
options instead of auto-fetching the schema. Cached schema still takes precedence
when available.
The composable now always creates a client (createForm handles optional
publicKey). submit() works without a schema — the client constructs
the URL from formId. canSubmit and bot protection watcher fall back to
options.botProtection when no schema exists.
Both Vue and Nuxt components now accept botProtection and honeypotField
as optional props for manual form building without a schema.
- Restore Task 3 composable changes (always-create client, submit guard,
  botProtection fallback) that were lost during Task 4 subagent stash
- Forward botProtection and honeypotField through Nuxt composable to
  Vue composable
- Add comment explaining validate is skipped in schema-less mode
@RobertBoes RobertBoes merged commit ebe5866 into main Apr 3, 2026
1 check failed
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.

1 participant