Rest api validator
Skill aborroy/aiup-alfresco/.cursor/skills/rest-api-validator
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.From its SKILL.md
npx -y skills add aborroy/aiup-alfresco --skill rest-api-validatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 13 stars13 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, 687 tokens by cl100k_base, as published. Nobody here has run it
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.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.