Define the declarative input-schema synthesis algorithm (#declarative-api is currently a TODO)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- html, json
- Lĩnh vực
- api
Hướng nghiên cứu
Start with the synthesize a declarative JSON Schema object TODO in index.bs and the Input schema synthesis section of declarative-api-explainer.md. Review the existing declarative API attribute model and the open questions in this issue, then settle the mapping and edge cases with the editors. Done means the explainer and spec algorithms define consistent, deterministic schemas; the issue mentions a reference implementation and 11 test cases but does not identify their files.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The declarative API needs a deterministic way to turn a <form> and its form-associated elements into a JSON Schema inputSchema, so agents can reliably fill out and submit declarative tools. Today this is unspecified in two places:
- In the spec,
#declarative-api— thesynthesize a declarative JSON Schema objectalgorithm is just1. TODO: Derive a conformant JSON Schema object from |form| and its form-associated elements. - In the explainer, the "Input schema synthesis" section is also marked TBD, noting we need to specify how elements like
<input>and<select>reduce to a JSON Schema.
I've joined the Web Machine Learning Community Group and would like to contribute a concrete proposal for this algorithm. I've also written a reference implementation that passes 11 test cases (details at the bottom). Sharing here for feedback before opening any PRs. It's intentionally conservative and aligned with the attribute model already in the explainer (toolname, tooldescription, name, toolparamdescription).
Proposed top-level shape
A <form> reduces to:
{
"type": "object",
"properties": { /* one entry per included, named control */ },
"required": [ /* names of controls carrying the `required` constraint */ ]
}
- Only named controls are included;
submit/reset/button/imageand unnamed/disabled controls are skipped. - Property key = the control's
name;descriptioncomes fromtoolparamdescription; a control'svaluemaps todefault. - Controls sharing one
name(radio groups, multi-checkboxes) are merged into a single property.
Proposed control → schema mapping
| Control | JSON Schema | Constraints |
|---|---|---|
text / search / tel / password |
{"type":"string"} |
minlength→minLength, maxlength→maxLength, pattern→pattern |
email |
{"type":"string","format":"email"} |
multiple → array of email strings |
url |
{"type":"string","format":"uri"} |
|
number |
{"type":"number"} |
min→minimum, max→maximum, numeric step→multipleOf (omit for any) |
range |
{"type":"number"} |
minimum default 0, maximum default 100 |
date / datetime-local / time |
{"type":"string","format":"date" | "date-time" | "time"} |
|
month / week / color |
{"type":"string","pattern": …} |
no standard format exists |
checkbox (single) |
{"type":"boolean"} |
|
radio group |
{"type":"string","enum":[values]} |
required if any member is required |
checkbox group |
{"type":"array","items":{"enum":[values]},"uniqueItems":true} |
|
<select> / <select multiple> |
{"type":"string","enum":[…]} / {"type":"array",…} |
option text used when value absent |
<textarea> |
{"type":"string"} |
minlength/maxlength |
Algorithm (sketch)
Two algorithms, mirroring the split of concerns:
synthesize a declarative JSON Schema object(form-level): collect submittable named controls, group them byname, buildpropertiesandrequired.map a form control to a JSON Schema property(control-level): switch on the control's type per the table above, applying string/numeric constraint helpers.
I have these written out in full Bikeshed-style steps and am happy to paste them here or bring them directly in a PR, whichever the editors prefer.
Worked example
<form toolname="search-cars" tooldescription="Perform a car make/model search">
<input type=text name="make" toolparamdescription="The vehicle's make" required>
<input type=text name="model" toolparamdescription="The vehicle's model" required>
<input type=number name="max_price" min="0" max="200000" step="500">
<select name="fuel"><option>Petrol<option>Diesel<option value="ev">Electric</select>
</form>
synthesizes to:
{
"type": "object",
"properties": {
"make": { "type": "string", "description": "The vehicle's make" },
"model": { "type": "string", "description": "The vehicle's model" },
"max_price": { "type": "number", "minimum": 0, "maximum": 200000, "multipleOf": 500 },
"fuel": { "type": "string", "enum": ["Petrol", "Diesel", "ev"] }
},
"required": ["make", "model"]
}
Open questions (would like editor guidance)
<input type=file>— binary uploads; defer until multimodal tool inputs (#41, #86) are resolved?<input type=hidden>— exclude (not agent-fillable), or expose as a fixedconst?disabled/readonly— excludedisabled(not submitted); what aboutreadonly?<datalist>— non-restrictive suggestions; map toexamplesrather thanenum?step+min— strictly a discrete value set; ismultipleOfan acceptable approximation, or should small ranges emit anenum?month/week— use an explicit regexpattern, or reference HTML's "valid month/week string" microsyntax via a note?formatas assertion — JSON Schema treatsformatas annotation by default; should the spec require agents to treatemail/uri/dateas assertions?
Reference implementation & tests
To validate the design I wrote a small reference implementation of both algorithms and a test suite (11 cases: the example above, string constraints, all format types, email multiple, range defaults, single checkbox, radio group, checkbox group, select multiple, excluded/hidden/file/disabled controls, and textarea/color/month). All 11 pass. I'm glad to share the code, and — if useful — to contribute these as Web Platform Tests so the feature is testable end-to-end.
Proposed next steps
If this direction looks reasonable, I'd open two small PRs once the open questions settle:
declarative-api-explainer.md— the mapping table + worked examples.index.bs— the two algorithms replacing the1. TODO.
Feedback very welcome, especially on the open questions above. Thanks!
- Ngôn ngữ chính
- Bikeshed
- Star
- 4.7k
- Fork
- 328
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của webmachinelearning/webmcp
-
Say how an agent should weigh annotations that the page wrote about itselfCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
webmachinelearning/webmcp#353 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
webmachinelearning/webmcp#343 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Agenda+ i18n-tracker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
webmachinelearning/webmcp#273 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
a11y-tracker Agenda+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
webmachinelearning/webmcp#272 · 4 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
webmachinelearning/webmcp#234 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của webmachinelearning/webmcp
Issue tương tự
-
`github-events` aborts the repository scan when a closed pull's API payload has a null `head`Có thể đã có người làm @renyamamoto2026-cmyk đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zerocracy/judges-action#2823 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test(fabric): load the TestLoad fixture through config.Service instead of a raw koanf decodeĐang mởcleanup hacktoberfest priority: low skill: good first issue testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hyperledger-labs/fabric-smart-client#2197 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
corro-client drops the last byte of a response line that has no trailing newlineCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
joinrpg/joinrpg-net#5752 ·
Maintainer thường phản hồi trong vòng 1 ngày