- What I verified (with evidence)
GET /Plone/@types/<type>currently returns JSON Schema-like data:properties,required,enum,enumNames,uniqueItems, etc.- In my local backend,
DocumentandEventonly showedrequired+enum/enumNames(anduniqueItemsin arrays).
- What I found in plone.restapi code
@typesendpoint served byTypesGet(services/types/get.py) →get_jsonschema_for_fti()(types/utils.py) →get_jsonschema_properties()usingIJsonSchemaProvideradapters per field.- Base serializer is
DefaultJsonSchemaProvider.get_schema()and subclasses overrideadditional().
- Gap: missing standard JSON Schema keys
readOnly: available asfield.readonlyfor all zope.schema fields, but not emitted.format: can be derived safely for specific field types (Email, URI, Date, Datetime), but not emitted.
These are standard JSON Schema annotations; would be additive and backward-compatible.
- Proposal (minimal + safe)
- Emit
"readOnly": trueonly whenfield.readonly == True(omit otherwise). - Emit
"format"for:- Email →
"email" - URI →
"uri" - Date →
"date" - Datetime →
"date-time"
- Email →
- Risks / questions for mentors
field.readonlyis static. Some editability may be dynamic (permissions/workflow).
Question: Is it acceptable to expose only static readOnly here, or do you prefer a different mechanism/endpoint for dynamic editability?- For
format, do you agree with the mapping above?
- If accepted, planned deliverables
- Backend: implement + tests (
test_types.py) - Frontend (Volto): optionally consume
readOnlyto disable inputs andformatto select widgets/validation (only if desired by mentors)
Are you OK with adding readOnly + format to @types/<type> output as described?