rest-api-validator
Skill14 starsChanged 5 months agoApache-2.0View on GitHub
Validates Alfresco v1 Public REST API resources for correct annotations (@EntityResource / @RelationshipResource), required @WebApiDescription on every action method, a single @UniqueId on the model POJO, paged collection returns, and absence of classic Web Script anti-patterns. Trigger automatically after generating or editing files under a rest/ package or any class annotated @EntityResource / @RelationshipResource.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/aiup-alfresco.mdcCursor rule
- aca-extensionSkill
- actionsSkill
- aikauSkill
- aiup-alfrescoSkill
- alfresco-architect-agentSkill
- alfresco-debugger-agentSkill
- alfresco-migrator-agentSkill
- audit-config-validatorSkill
- auditSkill
- behavioursSkill
- bootstrap-loaderSkill
- content-modelSkill
- content-model-validatorSkill
- content-storeSkill
- docker-compose-healthcheck-injectorSkill
- docker-composeSkill
- event-api-topology-checkerSkill
- eventsSkill
- metadata-extractorSkill
- migration-advisorSkill
- permission-aware-query-builderSkill
- permission-model-validatorSkill
- permissionsSkill
- repository-patchSkill
- requirementsSkill
- rest-apiSkill
- rule-conditionsSkill
- scaffoldSkill
- scheduled-jobsSkill
- sdk-version-detectorSkill
- share-configSkill
- subsystemSkill
- surfSkill
- testSkill
- transformsSkill
- web-scriptsSkill
- workflow-bpmn-validatorSkill
- workflowSkill
- audit-config-validatorSkill
- content-model-validatorSkill
- docker-compose-healthcheck-injectorSkill
- event-api-topology-checkerSkill
- migration-advisorSkill
- permission-aware-query-builderSkill
- permission-model-validatorSkill
- rest-api-validatorSkill
- sdk-version-detectorSkill
- workflow-bpmn-validatorSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Every entity resource class must be annotated @EntityResource(name = "...", title = "...").
- Very specific: line 14
Every relationship resource class must be annotated @RelationshipResource(name = "...", entityResource = X.class, title = "..."), and its …
- Very specific: line 29
Fix: add @WebApiDescription(title = "…") to every action method.
- Very specific: line 44
WARN: if @PostConstruct or @Transactional appears on a resource class.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
REST API Validator
Validate the given Alfresco v1 Public REST API resources against these rules. This is the
modern annotation-based framework (org.alfresco.rest.framework), not classic Web Scripts.
Annotation Validation
- Every entity resource class must be annotated
@EntityResource(name = "...", title = "..."). - Every relationship resource class must be annotated
@RelationshipResource(name = "...", entityResource = X.class, title = "..."), and itsentityResourcemust reference an existing@EntityResource-annotated class in the project. - The
nameon both annotations must be plural, kebab-case (e.g.vendor-contracts,payments) and contain no verbs.
Action Method Validation
- The resource class must implement at least one interface from
org.alfresco.rest.framework.resource.actions.interfaces—EntityResourceAction.Read/ReadById/Create/Update/Delete, orRelationshipResourceAction.Read/Create/Update/Delete. - FLAG as ERROR any public action method (
readAll,readById,create,update,delete) that is missing@WebApiDescription.- Why it breaks: the framework only maps annotated methods. An unannotated action method
is silently unreachable and the operation returns
405 Method Not Allowed. - Fix: add
@WebApiDescription(title = "…")to every action method.
- Why it breaks: the framework only maps annotated methods. An unannotated action method
is silently unreachable and the operation returns
- A
readAllmethod must returnCollectionWithPagingInfo<T>— FLAG as ERROR a rawList<T>/Collection<T>return (bypasses the paging envelope).
Model POJO Validation
- The returned/consumed model POJO must have exactly one getter annotated
@UniqueId.- FLAG as ERROR zero
@UniqueIdgetters (framework cannot buildreadById/ serialise id). - FLAG as ERROR more than one
@UniqueIdgetter (ambiguous identifier).
- FLAG as ERROR zero
- The POJO should be a plain JavaBean: public no-arg constructor, getters/setters, no Alfresco service fields.
Forbidden Patterns
- FLAG as ERROR a resource class that
extends DeclarativeWebScript— that is the classic framework and will not be discovered byResourceLookupDictionary. - FLAG as ERROR
@Autowired— use setter injection wired inwebscript-context.xml. - WARN if
@PostConstructor@Transactionalappears on a resource class.
Spring Registration Validation
- Each resource should be registered as a
<bean>inwebscript-context.xml(bean id{prefix}.{entity}EntityResource/{prefix}.{entity}{Relationship}RelationshipResource), andwebscript-context.xmlshould be imported frommodule-context.xml. - A resource bean needs no parent bean — flag a
parent="..."on a resource bean as likely incorrect.
Output
Report all violations with file path, line number, rule violated, and suggested fix. If no violations found, confirm the REST API resources are valid.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

