-
Notifications
You must be signed in to change notification settings - Fork 534
Add validation on resource id for import. #4977
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
Conversation
test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Import/ImportTests.cs
Fixed
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.Shared.Core/Features/Operations/Import/ImportResourceParser.cs
Outdated
Show resolved
Hide resolved
{ "?badresource&id", false }, | ||
{ "abc.123.ABC", true }, | ||
{ string.Empty, false }, | ||
{ Guid.NewGuid().ToString() + Guid.NewGuid().ToString(), false }, |
Check notice
Code scanning / CodeQL
Redundant ToString() call Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 10 days ago
To fix the issue, we will remove the redundant ToString()
call on line 1758. The Guid.NewGuid().ToString()
method already returns a string, so there is no need to call ToString()
on its result. This change will simplify the code without altering its functionality.
-
Copy modified line R1758
@@ -1757,3 +1757,3 @@ | ||
{ string.Empty, false }, | ||
{ Guid.NewGuid().ToString() + Guid.NewGuid().ToString(), false }, | ||
{ Guid.NewGuid() + Guid.NewGuid().ToString(), false }, | ||
}; |
{ "?badresource&id", false }, | ||
{ "abc.123.ABC", true }, | ||
{ string.Empty, false }, | ||
{ Guid.NewGuid().ToString() + Guid.NewGuid().ToString(), false }, |
Check notice
Code scanning / CodeQL
Redundant ToString() call Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 10 days ago
To fix the issue, we will remove the redundant ToString()
calls on the Guid.NewGuid()
objects in line 1758. The +
operator will implicitly convert the GUIDs to strings during concatenation, so the explicit calls are not needed. This change will make the code cleaner and more concise while maintaining the same functionality.
-
Copy modified line R1758
@@ -1757,3 +1757,3 @@ | ||
{ string.Empty, false }, | ||
{ Guid.NewGuid().ToString() + Guid.NewGuid().ToString(), false }, | ||
{ Guid.NewGuid() + Guid.NewGuid(), false }, | ||
}; |
Description
A validation is added on the resource id of resources in the import data.
Related issues
Addresses [issue #147537].
Bug 147537: Import should validate IDs
Testing
Tested by adding some unit and e2e tests.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)