Skip to content

Commit

Permalink
refactor: remove the need for async prefer headers
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Dec 15, 2019
1 parent 52ebafc commit 9837bc9
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 84 deletions.
67 changes: 67 additions & 0 deletions hydra/DataSheet/DataSheet.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .
@prefix hydra-box: <http://hydra-box.org/schema/> .
@prefix code: <https://code.described.at/> .
@prefix ds: <https://facts.wikibus.org/vocab#> .
@prefix api: <https://facts.wikibus.org/api#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix impl: <file:lib/express/handlers/data-sheet/>.

api:dataSheetCollection
a hydra:Link ;
rdfs:range api:DataSheetCollection ;
hydra:supportedOperation _:PostToCollection .

_:PostToCollection a hydra-box:View,
schema:CreateAction ;
hydra:title "Create a data sheet" ;
hydra:method "POST" ;
hydra:expects ds:DataSheet ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link impl:create#post ;
]
)
] .

ds:DataSheet a hydra:Class ;
hydra:supportedProperty [
hydra:property rdfs:label ;
hydra:required true
] ;
hydra:supportedOperation _:Get,
_:Update .

_:Get a hydra-box:View ;
hydra:method "GET" ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link impl:instance#get ;
]
)
] .

_:Update a hydra-box:View,
schema:UpdateAction ;
hydra:method "PUT" ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link impl:instance#put ;
]
[
a code:EcmaScript ;
code:link impl:instance#get ;
]
)
] .

<data-sheet/:id> a ds:DataSheet .
68 changes: 0 additions & 68 deletions hydra/apidoc.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -28,73 +28,5 @@ api:Entrypoint a hydra:Class ;
]
] .

api:dataSheetCollection
a hydra:Link ;
rdfs:range api:DataSheetCollection ;
hydra:supportedOperation [
a hydra-box:View,
schema:CreateAction ;
hydra:title "Create a data sheet" ;
hydra:method "POST" ;
hydra:expects ds:DataSheet ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link
<file:lib/express/handlers/data-sheet/create#post>
]
)
]
] .

ds:DataSheet a hydra:Class ;
hydra:supportedProperty [
hydra:property rdfs:label ;
hydra:required true
] ;
hydra:supportedOperation [
a hydra-box:View ;
hydra:method "GET" ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link
<file:lib/express/handlers/data-sheet/instance#get>
]
)
]
],
[
a hydra-box:View,
schema:UpdateAction ;
hydra:method "PUT" ;
code:implementedBy [
a hydra-box:middlewareChain ;
code:arguments (
[
a code:EcmaScript ;
code:link
<file:lib/express/handlers/data-sheet/instance#put>
]
[
a code:EcmaScript ;
code:link
<file:lib/express/async#preferredTimeout>
]
[
a code:EcmaScript ;
code:link
<file:lib/express/handlers/data-sheet/instance#get>
]
)
]
] .

<> a api:Entrypoint ;
api:dataSheetCollection <data-sheets> .

<data-sheet/:id> a ds:DataSheet .
15 changes: 0 additions & 15 deletions lib/express/async.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/DataSheet/CreateRename.hydra
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ With Class ds:DataSheet {
Expect Operation schema:UpdateAction {
Invoke {
Content-Type "text/turtle"
Prefer "respond-async; wait=0.5"

```
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
Expand Down

0 comments on commit 9837bc9

Please sign in to comment.