shinesolutions / swagger-aem

OpenAPI specification for Adobe Experience Manager (AEM) API
Apache License 2.0
37 stars 22 forks source link

Introduce response models for operations with application/json payload #25

Open cliffano opened 7 years ago

cliffano commented 7 years ago

All operations currently pass all responses as string. While this is useful for xml, html, and plain text payload where processing is handled at the next layer (e.g. ruby_aem), this is not necessarily true for json payload where responses can be modelled at OpenAPI spec.

When the API introduces the model, need to also update ruby_aem to handle the model instead of json parsing.

cliffano commented 7 years ago

Sample payload for aem-healthcheck: {"results":[{"name":"Smoke Health Check","status":"OK","timeMs":1}]}

cliffano commented 7 years ago

Sample payload for agents list: {"jcr:primaryType":"cq:Page","jcr:mixinTypes":["rep:AccessControllable"],"jcr:createdBy":"admin","jcr:created":"Wed May 17 2017 11:19:29 GMT+1000","jcr:content":{"jcr:primaryType":"nt:unstructured","jcr:title":"Agents on author","cq:template":"/libs/cq/replication/templates/agents","sling:resourceType":"cq/replication/components/agents"},"rep:policy":{"jcr:primaryType":"rep:ACL","allow":{"jcr:primaryType":"rep:GrantACE","rep:principalName":"offloading-agentmanager","rep:privileges":["jcr:read","rep:write"]},"deny":{"jcr:primaryType":"rep:DenyACE","rep:principalName":"replication-service","rep:privileges":["crx:replicate"]}},"some-flush-agent":{"jcr:primaryType":"cq:Page","jcr:createdBy":"admin","jcr:created":"Sat Oct 21 2017 14:26:32 GMT+1100","jcr:content":{"jcr:primaryType":"nt:unstructured","jcr:mixinTypes":["cq:ReplicationStatus"],"jcr:title":"Some Flush Agent Title","enabled":"true","transportUri":"http://somehost:8080/dispatcher/invalidate.cache","cq:template":"/libs/cq/replication/templates/agent","serializationType":"flush","retryDelay":"30000","cq:lastModified":"Sat Oct 21 2017 14:26:32 GMT+1100","triggerSpecific":"true","jcr:description":"Some flush agent description","noVersioning":"true","cq:name":"some-flush-agent","protocolHTTPMethod":"GET","sling:resourceType":"cq/replication/components/agent","triggerReceive":"true","protocolHTTPHeaders":["CQ-Action:{action}","CQ-Handle:{path}","CQ-Path:{path}"],"cq:lastModifiedBy":"admin","logLevel":"error"}},"some-outbox-replication-agent":{"jcr:primaryType":"cq:Page","jcr:createdBy":"admin","jcr:created":"Sat Oct 21 2017 14:26:34 GMT+1100","jcr:content":{"jcr:primaryType":"nt:unstructured","jcr:title":"Some Outbox Replication Agent Title","enabled":"true","transportUri":"repo://var/replication/outbox","cq:template":"/libs/cq/replication/templates/agent","userId":"admin","cq:lastModified":"Sat Oct 21 2017 14:26:34 GMT+1100","triggerSpecific":"true","jcr:description":"Some outbox replication agent description","triggerDistribute":"true","noVersioning":"true","cq:name":"some-outbox-replication-agent","sling:resourceType":"cq/replication/components/agent","cq:lastModifiedBy":"admin","logLevel":"error"}},"some-replication-agent":{"jcr:primaryType":"cq:Page","jcr:createdBy":"admin","jcr:created":"Sat Oct 21 2017 14:26:37 GMT+1100","jcr:content":{"jcr:primaryType":"nt:unstructured","jcr:title":"Some replication Agent Title","enabled":"true","transportUri":"http://somehost:8080/bin/receive?sling:authRequestLogin=1","transportUser":"admin","cq:template":"/libs/cq/replication/templates/agent","serializationType":"durbo","retryDelay":"30000","cq:lastModified":"Sat Oct 21 2017 14:26:37 GMT+1100","jcr:description":"Some replication agent description","cq:name":"some-replication-agent","sling:resourceType":"cq/replication/components/agent","transportPassword":"{9228c00b6a1f122f59da03b8fceaa939f0ea8b0e6c3fc34f32d164d9822c4920}","cq:lastModifiedBy":"admin","logLevel":"error"}},"some-reverse-replication-agent":{"jcr:primaryType":"cq:Page","jcr:createdBy":"admin","jcr:created":"Sat Oct 21 2017 14:26:37 GMT+1100","jcr:content":{"jcr:primaryType":"nt:unstructured","jcr:title":"Some Reverse Replication Agent Title","enabled":"true","transportUri":"http://somehost:8080/bin/receive?sling:authRequestLogin=1","transportUser":"admin","reverseReplication":"true","cq:template":"/libs/cq/replication/templates/agent","serializationType":"durbo","retryDelay":"30000","cq:lastModified":"Sat Oct 21 2017 14:26:37 GMT+1100","jcr:description":"Some reverse replication agent description","cq:name":"some-reverse-replication-agent","sling:resourceType":"cq/replication/components/agent","transportPassword":"{06ae6c34ce617e72aa41f156b212b0fed75a2b5b2d850b06fe87481ce9aa0181}","cq:lastModifiedBy":"admin","logLevel":"error"}}}

cliffano commented 7 years ago

Sample payload for package filter: { "jcr:primaryType": "nt:unstructured", "f0": { "jcr:primaryType": "nt:unstructured", "mode": "replace", "root": "/apps/geometrixx", "rules": [] }, "f1": { "jcr:primaryType": "nt:unstructured", "mode": "replace", "root": "/apps/geometrixx-common", "rules": [] } } { "jcr:primaryType": "nt:unstructured", "f0": { "jcr:primaryType": "nt:unstructured", "mode": "replace", "root": "/apps/geometrixx", "rules": [] }, "f1": { "jcr:primaryType": "nt:unstructured", "mode": "replace", "root": "/apps/geometrixx-common", "rules": [] } }

cliffano commented 7 years ago

Sample payload for package service: {"success":true,"msg":"Package created","path":"/etc/packages/somepackagegroup/somepackage-1.2.3.zip"}

cliffano commented 7 years ago

Sample payload for authorizable ID: {"success":true,"results":1,"total":1,"more":false,"offset":0,"hits":[{"path":"/home/groups/s/uR7xoCS3wj_rYQ5xRClG","excerpt":"","name":"uR7xoCS3wj_rYQ5xRClG","title":"uR7xoCS3wj_rYQ5xRClG","lastModified":"2017-10-21 14:35:34","created":"2017-10-21 14:35:34"}]} {"success":true,"results":0,"total":0,"more":false,"offset":0,"hits":[]}