Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change signature of Router.Create to deserialize to option #979

Closed
Jand42 opened this Issue Jul 3, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@Jand42
Copy link
Member

Jand42 commented Jul 3, 2018

For creating routers for server/client shared use, this would be more useful than current Router.Create:

    let CreateRouter (ser: 'T -> list<string>) (des: list<string> -> option<'T>) =
        {
            Parse = fun path ->
                match des path.Segments with
                | Some ep ->
                    Seq.singleton ({ path with Segments = [] }, ep)
                | None ->
                    Seq.empty
            Write = fun value ->
                Some (Seq.singleton (Route.Segment(ser value)))
        } : Router<'T>

Current one is deserializing to 'T, not option<'T>, which is ok for fully client-side routing use when one of the EndPoint cases are representing a wrong URI, but not good for server-side use when even resource links would be hijacked by Sitelets routing if set up that way. Changing signature is a breaking change, but probably less confusing than having two different functions for the same basic goal, but one only working in a specific side case.

@Jand42 Jand42 self-assigned this Jul 5, 2018

Jand42 added a commit that referenced this issue Jul 5, 2018

@Jand42 Jand42 closed this Jul 5, 2018

@Tarmil Tarmil added the 4.4.0.280 label Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.