Skip to content

Commit

Permalink
Merge pull request #6 from hiposfer/feature
Browse files Browse the repository at this point in the history
limited-feature TODO added
  • Loading branch information
carocad authored Jan 19, 2018
2 parents a93dcf4 + e590df8 commit 61be61f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/hiposfer/geojson/specs.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,22 @@
:opt-un [::bbox]))

;; -------------- utility functions

;; TODO: after much try and error I found out that it is not possible to
;; have such function due to the way that Clojure spec works. However, there
;; is an option to create it ... macros !!
;; it should be possible to create a macro that will resolve the geometry required
;; as a keyword and build an s/keys with it.
;; There is another problem however. We need to register all posible geometries
;; beforehand and decide on macro execution which one to take based on the user input
;; probably something like this:
;(defmacro foo [keyspec]
; (let [names {::geojson/linestring :line/geometry
; ::geojson/point :point/geometry}]
; (s/keys :req-un [:hiposfer.geojson.specs.feature/type
; (names keyspec)])))
;; however since I am not using the feature at the moment I havent tried it. If you
;; want this feature and came to this point, please submit a PR so that we can all
;; benefit from it :)
(defn limited-feature
"returns an feature spec that conforms only to the specified geometry type
instead of any geometry object"
Expand Down

0 comments on commit 61be61f

Please # to comment.