Add introspection endpoints for types, schema and workflow - #108
Open
ramonski wants to merge 2 commits into
Open
Add introspection endpoints for types, schema and workflow#108ramonski wants to merge 2 commits into
ramonski wants to merge 2 commits into
Conversation
ramonski
added a commit
that referenced
this pull request
Jul 28, 2026
ramonski
added a commit
that referenced
this pull request
Jul 28, 2026
ramonski
force-pushed
the
feature/introspection-endpoints
branch
from
July 28, 2026 18:42
8fb6103 to
20947fb
Compare
Adds three read-only routes so a client can discover the data model instead
of scraping the UI:
/types list the portal types (optionally addable in a
container via parent_uid / parent_path)
/types/<portal_type> describe a single portal type, including the catalogs
that index it and the permission required to add it
/schema/<portal_type> describe the schema fields (type, required, readonly,
and reference target types), for both Archetypes and
Dexterity content
/workflow/<uid> the current review state and the available transitions
ramonski
force-pushed
the
feature/introspection-endpoints
branch
from
July 28, 2026 18:44
20947fb to
79c3772
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses
There is currently no way for an API client to discover the data model. To create or update content it has to know the exact portal type name, the field names and their types up front, which in practice means scraping the add/edit forms in the UI (for example to learn that the type is
AnalysisSpec, notAnalysisSpecification, or that a Sample's specification lives on a single valued reference field). This adds three read-only introspection routes. They are schema and FTI driven, so custom add-on types (including ones with their own catalog and add permission) are covered without special casing.GET /senaite/v1/typeslists the registered portal types. Passparent_uidorparent_pathto restrict the listing to the types that can be added inside that container (this honors programmatic constraints, so a restricted type such as a custom order type only shows up under the containers that actually allow it).GET /senaite/v1/types/<portal_type>describes a single portal type: title, description, meta type,global_allow(whether it is addable anywhere or only where a container allows it), theadd_permission, and thecatalogsthat index it.GET /senaite/v1/schema/<portal_type>describes the schema fields: name, type, whether the field is required or read only, whether it is multi valued, and for reference fields the portal types it may point to. Works for both Archetypes content (introspected from an existing instance) and Dexterity content, including behavior fields.GET /senaite/v1/workflow/<uid>returns the current review state and the available transitions of an object, so a client can answer "what can I do with this now" without guessing transition ids.Current behavior before PR
No type, schema or workflow introspection is exposed by the API.
Desired behavior after PR is merged
The four routes above are available and covered by a new
introspect.rstdoctest.--
I confirm I have coded it according to PEP8 standards.