Copilot Chat: Url DataAnnotation is not compatible with Uri. Should be string#1842
Merged
gitri-ms merged 3 commits intomicrosoft:mainfrom Jul 5, 2023
Merged
Copilot Chat: Url DataAnnotation is not compatible with Uri. Should be string#1842gitri-ms merged 3 commits intomicrosoft:mainfrom
gitri-ms merged 3 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
|
FYI the markdown check failing is not due to this PR, it's a separate issue with a fix incoming |
Contributor
Author
What about the merge gatekeeper? It's failing, but don't know why. |
Contributor
Merge gatekeeper is failing because the markdown check failed. Nothing to worry about there either. |
gitri-ms
approved these changes
Jul 5, 2023
Contributor
|
Thanks @jpaarhuis! |
shawncal
added a commit
to shawncal/semantic-kernel
that referenced
this pull request
Jul 6, 2023
…e string (microsoft#1842) Having Url annotation check with an Uri type always fails. The reason is that the UrlAttribute IsValid method always checks if the value is of type string: ```cs public override bool IsValid(object? value) { if (value == null) { return true; } return value is string valueAsString && (valueAsString.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || valueAsString.StartsWith("https://", StringComparison.OrdinalIgnoreCase) || valueAsString.StartsWith("ftp://", StringComparison.OrdinalIgnoreCase)); } ``` Changing Uri to string here works fine (tested) while keeping the annotation check. For reference see: dotnet/runtime#71008 --------- Co-authored-by: Jeffrey Paarhuis <jpaarhuis@home.nl> Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
golden-aries
pushed a commit
to golden-aries/semantic-kernel
that referenced
this pull request
Oct 10, 2023
…e string (microsoft#1842) Having Url annotation check with an Uri type always fails. The reason is that the UrlAttribute IsValid method always checks if the value is of type string: ```cs public override bool IsValid(object? value) { if (value == null) { return true; } return value is string valueAsString && (valueAsString.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || valueAsString.StartsWith("https://", StringComparison.OrdinalIgnoreCase) || valueAsString.StartsWith("ftp://", StringComparison.OrdinalIgnoreCase)); } ``` Changing Uri to string here works fine (tested) while keeping the annotation check. For reference see: dotnet/runtime#71008 --------- Co-authored-by: Jeffrey Paarhuis <jpaarhuis@home.nl> Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Having Url annotation check with an Uri type always fails.
The reason is that the UrlAttribute IsValid method always checks if the value is of type string:
Changing Uri to string here works fine (tested) while keeping the annotation check.
For reference see: dotnet/runtime#71008