Skip to content

Validate LinkParser #10792

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

Closed
6 tasks done
rynowak opened this issue Jun 3, 2019 · 1 comment
Closed
6 tasks done

Validate LinkParser #10792

rynowak opened this issue Jun 3, 2019 · 1 comment
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed Validation This issue is used to track validation efforts

Comments

@rynowak
Copy link
Member

rynowak commented Jun 3, 2019

Summary

LinkParser is a new singleton service that can be used with endpoint routing to parse URL paths and extract route values.

The common use case for this is when you have URLs as part of your domain model. You want some way to parse these URLs using a well-known template and get route values (usually the id).

Example:

[HttpPut]
[Route("/Products/{id}", Name = "ProductsRoute")]
public async Task<IActionResult> AddRelatedProduct(int projectId, string path)
{
   var values = parser.ParsePathByEndpointName("ProductsRoute", path);
   var relatedId = (string)values["id"];

   // Do something with this information
}

Checklist:

  • Can parse a path successfully with a known route (routename)
  • Fails for an unknown route (returns null)
  • Fails for a path that doesn't match
  • Includes default values from the route
  • Runs route constraints (use a route constraint that doesn't match)
  • Look at the logging for success and failure cases - is it good?

References

@rynowak rynowak added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jun 3, 2019
@rynowak rynowak added this to the 3.0.0-preview6 milestone Jun 3, 2019
@mkArtakMSFT mkArtakMSFT added the Validation This issue is used to track validation efforts label Jun 3, 2019
@ryanbrandenburg
Copy link
Contributor

Everything behaved as expected and the console logging seems reasonable. At first glance the wording of the log seemed weird (endpoints vs address vs URI) but looking at it again I think you were just trying to be precise.

@ryanbrandenburg ryanbrandenburg added the Done This issue has been fixed label Jun 4, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed Validation This issue is used to track validation efforts
Projects
None yet
Development

No branches or pull requests

3 participants