The Api-platform REST Admin makes a few requests to gather the services metadata before building its interface including the navigation
menu. It expects the root URL to return a basic list of services with an Entrypoint context.
{
"@context": "/contexts/Entrypoint",
"@id": "/",
"@type": "Entrypoint",
"case": "/cases"
}
The Entrypoint context itself is called to fetch the URL of the JSON-LD Docs.
{
"@context": {
"@vocab": "http://api.ds.ca/docs.jsonld#",
"hydra": "http://www.w3.org/ns/hydra/core#",
"case": {
"@id": "Entrypoint/case",
"@type": "@id"
}
}
}
The JSON-LD Docs file describes, in details, all the entrypoints that will be listed in the navigation
as well as the properties and operations of the microservices.
{
"@context": {
"@vocab": "http://api.ds.ca/docs.jsonld#",
"hydra": "http://www.w3.org/ns/hydra/core#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xmls": "http://www.w3.org/2001/XMLSchema#",
"owl": "http://www.w3.org/2002/07/owl#",
"domain": {
"@id": "rdfs:domain",
"@type": "@id"
},
"range": {
"@id": "rdfs:range",
"@type": "@id"
},
"subClassOf": {
"@id": "rdfs:subClassOf",
"@type": "@id"
},
"expects": {
"@id": "hydra:expects",
"@type": "@id"
},
"returns": {
"@id": "hydra:returns",
"@type": "@id"
}
},
"@id": "/docs.jsonld",
"hydra:title": "Cases",
"hydra:description": "The DigitalState Cases Api",
"hydra:entrypoint": "/",
"hydra:supportedClass": [
{
"@id": "#Case",
"@type": "hydra:Class",
"rdfs:label": "Case",
"hydra:title": "Case",
"hydra:supportedProperty": [
{
"@type": "hydra:SupportedProperty",
"hydra:property": {
"@id": "#Case/title",
"@type": "rdf:Property",
"rdfs:label": "title",
"domain": "#Case",
"range": "xmls:string"
},
"hydra:title": "title",
"hydra:required": true,
"hydra:readable": true,
"hydra:writable": true
}
],
"hydra:supportedOperation": [
{
"@type": "hydra:Operation",
"hydra:method": "GET",
"hydra:title": "Retrieves Case resource.",
"rdfs:label": "Retrieves Case resource.",
"returns": "#Case"
},
{
"@type": "hydra:ReplaceResourceOperation",
"expects": "#Case",
"hydra:method": "PUT",
"hydra:title": "Replaces the Case resource.",
"rdfs:label": "Replaces the Case resource.",
"returns": "#Case"
},
{
"@type": "hydra:Operation",
"hydra:method": "DELETE",
"hydra:title": "Deletes the Case resource.",
"rdfs:label": "Deletes the Case resource.",
"returns": "owl:Nothing"
}
],
"hydra:description": "Class CaseEntity"
},
{
"@id": "#Entrypoint",
"@type": "hydra:Class",
"hydra:title": "The API entrypoint",
"hydra:supportedProperty": [
{
"@type": "hydra:SupportedProperty",
"hydra:property": {
"@id": "#Entrypoint/case",
"@type": "hydra:Link",
"domain": "#Entrypoint",
"rdfs:label": "The collection of Case resources",
"range": "hydra:PagedCollection",
"hydra:supportedOperation": [
{
"@type": "hydra:Operation",
"hydra:method": "GET",
"hydra:title": "Retrieves the collection of Case resources.",
"rdfs:label": "Retrieves the collection of Case resources.",
"returns": "hydra:PagedCollection"
},
{
"@type": "hydra:CreateResourceOperation",
"expects": "#Case",
"hydra:method": "POST",
"hydra:title": "Creates a Case resource.",
"rdfs:label": "Creates a Case resource.",
"returns": "#Case"
}
]
},
"hydra:title": "The collection of Case resources",
"hydra:readable": true,
"hydra:writable": false
}
],
"hydra:supportedOperation": {
"@type": "hydra:Operation",
"hydra:method": "GET",
"rdfs:label": "The API entrypoint.",
"returns": "#EntryPoint"
}
},
{
"@id": "#ConstraintViolation",
"@type": "hydra:Class",
"hydra:title": "A constraint violation",
"hydra:supportedProperty": [
{
"@type": "hydra:SupportedProperty",
"hydra:property": {
"@id": "#ConstraintViolation/propertyPath",
"@type": "rdf:Property",
"rdfs:label": "propertyPath",
"domain": "#ConstraintViolation",
"range": "xmls:string"
},
"hydra:title": "propertyPath",
"hydra:description": "The property path of the violation",
"hydra:readable": true,
"hydra:writable": false
},
{
"@type": "hydra:SupportedProperty",
"hydra:property": {
"@id": "#ConstraintViolation/message",
"@type": "rdf:Property",
"rdfs:label": "message",
"domain": "#ConstraintViolation",
"range": "xmls:string"
},
"hydra:title": "message",
"hydra:description": "The message associated with the violation",
"hydra:readable": true,
"hydra:writable": false
}
]
},
{
"@id": "#ConstraintViolationList",
"@type": "hydra:Class",
"subClassOf": "hydra:Error",
"hydra:title": "A constraint violation list",
"hydra:supportedProperty": [
{
"@type": "hydra:SupportedProperty",
"hydra:property": {
"@id": "#ConstraintViolationList/violations",
"@type": "rdf:Property",
"rdfs:label": "violations",
"domain": "#ConstraintViolationList",
"range": "#ConstraintViolation"
},
"hydra:title": "violations",
"hydra:description": "The violations",
"hydra:readable": true,
"hydra:writable": false
}
]
}
]
}
We need to dynamically merge the JSON output of each of those calls by inspecting the output of their counterparts in
each microservice
The Api-platform REST Admin makes a few requests to gather the services metadata before building its interface including the navigation
menu. It expects the root URL to return a basic list of services with an Entrypoint context.
http://api.ds.ca/The Entrypoint context itself is called to fetch the URL of the JSON-LD Docs.
http://api.ds.ca/contexts/EntrypointThe JSON-LD Docs file describes, in details, all the entrypoints that will be listed in the navigation
as well as the properties and operations of the microservices.
http://api.ds.ca/docs.jsonldWe need to dynamically merge the JSON output of each of those calls by inspecting the output of their counterparts in
each microservice
See https://github.com/openresty/docker-openresty
/,/docs.jsonldandcontexts/Entrypointso they refer to PHP scripts.URLs mentioned above from each microservice before combining it all together.