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

Expose ModelStateDictionary #8

Closed
sasmithjr opened this issue Jan 25, 2019 · 2 comments
Closed

Expose ModelStateDictionary #8

sasmithjr opened this issue Jan 25, 2019 · 2 comments

Comments

@sasmithjr
Copy link
Contributor

sasmithjr commented Jan 25, 2019

I was wondering what your thoughts were on adding a parameter to RazorEngine.renderView to pass in a ModelStateDictionary option. I understand that you don't want to expose a lot of attribute-based validation in Giraffe (per this discussion), so that's why I'm suggesting only adding the parameter to renderView and not to the handlers (also, it's less likely to break most existing users of the library if the change isn't to the http handlers).

I'm not a Razor expert, to be clear; I was converting an existing C# example (this) to F# w/ Giraffe.Razor to learn and ran in to this issue. I bumped in to this is because I was trying to use Microsoft.AspNetCore.Mvc.TagHelpers, specifically asp-validation-summary, to reuse the same view while providing form validation feedback to the user in the Login view.

I can create a PR if you're okay with adding this parameter to RazorEngine.renderView, but it would be a breaking change.

Edit: Currently, an empty ModelStateDictionary is created here.

@dustinmoris
Copy link
Member

I think wanting to pass in a ModelStateDictionary is probably a reasonable change, because it is an integral part of the Razor experience, so I'm happy with this change.

Feel free to provide a PR and we can take it from there!

@Lanayx
Copy link

Lanayx commented Feb 24, 2019

Hi! Just updated the package and found this breaking change... Just wanted to suggest that idea one more time, instead of adding more and more parameters to the handler to group them into VieModel type, since with each new parameter changes will be breaking again and again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants