Some issue with UUID in uri
Given the following setup, the response contains an invalid 'uri' value:
"d": { ": { "uri": "http://localhost:9494/entities(4554f31a-7382-43eb-bfb4-b93ab4a0de51)", "type": "Entity" }
The following version works, but I'm not sure 'guid' is equivalent of 'uuid':
http://localhost:7000/entities(guid'4554f31a-7382-43eb-bfb4-b93ab4a0de51')
require 'safrano'
DB = Sequel.connect ENV['DB_URL']
DB.extension :pg_enum
Sequel::Model.db = DB
DB.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"'
DB.create_table? :entities do
uuid :id, primary_key: true, default: Sequel.function(:uuid_generate_v4)
foreign_key :parent_id
String :name
end
class Entity < Sequel::Model
one_to_many :children, key: :parent_id, class: self
end
class ODataSrv < Safrano::ServerApp
publish_service do
publish_model Entity, :entities do
add_nav_prop_collection :children
end
end
end
run ODataSrv.new