{"action":"created","issue":{"url":"https://api.github.com/repos/cognitect-labs/vase/issues/68","repository_url":"https://api.github.com/repos/cognitect-labs/vase","labels_url":"https://api.github.com/repos/cognitect-labs/vase/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/cognitect-labs/vase/issues/68/comments","events_url":"https://api.github.com/repos/cognitect-labs/vase/issues/68/events","html_url":"https://github.com/cognitect-labs/vase/issues/68","id":218758967,"number":68,"title":"Support edn coercion in vase/transact","user":{"login":"deg","id":90383,"avatar_url":"https://avatars2.githubusercontent.com/u/90383?v=3","gravatar_id":"","url":"https://api.github.com/users/deg","html_url":"https://github.com/deg","followers_url":"https://api.github.com/users/deg/followers","following_url":"https://api.github.com/users/deg/following{/other_user}","gists_url":"https://api.github.com/users/deg/gists{/gist_id}","starred_url":"https://api.github.com/users/deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deg/subscriptions","organizations_url":"https://api.github.com/users/deg/orgs","repos_url":"https://api.github.com/users/deg/repos","events_url":"https://api.github.com/users/deg/events{/privacy}","received_events_url":"https://api.github.com/users/deg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-02T11:37:59Z","updated_at":"2017-04-02T15:02:40Z","closed_at":null,"body":"The current Vase syntax does not make it easy to create new entities with non-string types.\r\n`:edn-coerce` is supported for `#vase/query`, but not for `#vase/transact`.\r\n\r\nSo, this common operation can only be done currently with an interceptor.\r\nThis pattern appears a couple of times in the current samples, e.g. [https://github.com/cognitect-labs/vase/blob/master/samples/petstore-full/src/petstore_full/interceptors.clj#L10](https://github.com/cognitect-labs/vase/blob/master/samples/petstore-full/src/petstore_full/interceptors.clj#L10). To me, this pattern appears verbose and fragile, especially for such a common operation.\r\n\r\nI see several possible ways to extend the syntax:\r\n\r\n1.  **Support `:edn-coerce` in `#vase/transact` maps**. But, this is awkward, since the current syntax refers only to the fully-namespaced keywords in the `:properties` vector, with no `:params` bindings.\r\n2. **Extend the syntax of `:properties`**. Currently this is a vector of keywords. Each keyword could optionally be a map including, e.g., `:edn-coerce true`.\r\n3. **Extend the syntax of `#vase/transact`**.  Add a `:params` bindings clause. This can then support end coercion in a syntax exactly parallel to `#vase/query`. It could also offer an option to define entity-creating routes where the exposed API parameter name does not have to exactly match the internal database attribute keyword. \r\n4. **Extend `:params` in both `#vase/transact` and `#vase/query`**.  This addresses an additional issue too. `:edn-coerce` feels a bit unnatural to me. It would be cleaner to have this typing request be part of each parameter in the `:params` vector.\r\n"},"comment":{"url":"https://api.github.com/repos/cognitect-labs/vase/issues/comments/290991874","html_url":"https://github.com/cognitect-labs/vase/issues/68#issuecomment-290991874","issue_url":"https://api.github.com/repos/cognitect-labs/vase/issues/68","id":290991874,"user":{"login":"ohpauleez","id":153929,"avatar_url":"https://avatars3.githubusercontent.com/u/153929?v=3","gravatar_id":"","url":"https://api.github.com/users/ohpauleez","html_url":"https://github.com/ohpauleez","followers_url":"https://api.github.com/users/ohpauleez/followers","following_url":"https://api.github.com/users/ohpauleez/following{/other_user}","gists_url":"https://api.github.com/users/ohpauleez/gists{/gist_id}","starred_url":"https://api.github.com/users/ohpauleez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohpauleez/subscriptions","organizations_url":"https://api.github.com/users/ohpauleez/orgs","repos_url":"https://api.github.com/users/ohpauleez/repos","events_url":"https://api.github.com/users/ohpauleez/events{/privacy}","received_events_url":"https://api.github.com/users/ohpauleez/received_events","type":"User","site_admin":false},"created_at":"2017-04-02T15:02:40Z","updated_at":"2017-04-02T15:02:40Z","body":"On master, the transact action literal supports JSON, Transit, and edn.  The default data exchange format for a Vase service is JSON, with all of the limitations of JSON (as well as its ubiquity).  `transact` doesn't have `:edn-coerce` because the value types are determined by the data exchange format -- You should only have string data if you actually send string values as part of the JSON payload.\r\n\r\nIf you have UUID/Instant/Custom data type representations in your schema, you ether have to \"double-parse\" as done in the link you provided (this is typically what most JSON services do, regardless of language/platform), or change data formats for your given API (which can be seen in [this example](https://github.com/cognitect-labs/vase/blob/master/test/resources/test_descriptor.edn#L120-L128))\r\n\r\n"}}
{"actor":{"display_login":"ohpauleez"}}