Conversation
a7ffcf6 to
02f6fd6
Compare
|
Rebased on main. |
zonotope
left a comment
There was a problem hiding this comment.
I have a few suggestions, but looks good.
src/fluree/server/handler.clj
Outdated
| (defn wrap-header-opts | ||
| "Extract options from headers, parse and validate them where necessary, and attach to | ||
| request. Opts set in the header override those specified within the transaction or | ||
| query. Intended mainly to provide a method of specifying opts for SPARQL queries" |
There was a problem hiding this comment.
Super minor, but I would drop this last sentence since these opts apply generally.
src/fluree/server/handler.clj
Outdated
| (fn [{:keys [headers credential/did] :as req}] | ||
| (let [{:keys [meta max-fuel identity policy-identity policy policy-class policy-values format output]} | ||
| (-> headers | ||
| (select-keys ["fluree-meta" "fluree-max-fuel" "fluree-identity" "fluree-policy-identity" |
There was a problem hiding this comment.
I think these recognized keys should be defined in a separate top level binding so we can easily reference the recognized header options.
|
|
||
| meta (when meta | ||
| (case meta | ||
| "false" false |
There was a problem hiding this comment.
I think it's friendlier to run clojure.string/lower-case on this value first.
| {:status 400}))))) | ||
| policy-values (when policy-values | ||
| (try (let [pv (json/parse policy-values false)] | ||
| (if (sequential? pv) |
There was a problem hiding this comment.
Does it make sense to validate this with malli since we already have a validator for that defined?
There was a problem hiding this comment.
I think the original idea was that the whole query will be run through the coercer/validator down the line, so we just do a very cheap check right here. If it's malformed we'll get a proper error message when the whole query is checked.
|
This PR depends on a couple of companion PRs in |
Now we support all query opts as headers prefixed with "Fluree-". By handling them in middleware we can ensure that we never accidentally forget to override supplied identities with the verified identity. We don't currently support transaction opts but this would be a useful place to introduce that support in the future.
24b13c4 to
c28643a
Compare
|
Rebased on main. |
This adds support for
Accept: application/sparql-results+jsonheaders, making ourfluree/queryendpoint a SPARQL Protocol compliant endpoint.I also added support for all query opts being specified as http headers in order to bring feature parity to SPARQL queries. Options specified in headers take precedence over those specified in the query body for FQL.
Related to https://github.com/fluree/core/issues/170