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

Updating the error message during conditional reference #4691

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

v-shnarang
Copy link
Contributor

Description

The PR updates the error message of conditional references when multiple resources are found. Instead of stating "does not resolve to a resource," the message will now indicate that the reference resolved to multiple resources.

Related issues

Addresses issue #77964.

Testing

These changes were tested on the OSS FHIR server, and we received the expected error output.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@v-shnarang v-shnarang added the Bug Bug bug bug. label Oct 22, 2024
@v-shnarang v-shnarang added this to the S152 milestone Oct 22, 2024
@v-shnarang v-shnarang requested a review from a team as a code owner October 22, 2024 13:28
@v-shnarang v-shnarang added Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug. and removed Bug Bug bug bug. labels Oct 22, 2024
@LTA-Thinking
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -70,10 +70,14 @@ public async Task ResolveReferencesAsync(Resource resource, IDictionary<string,

var results = await GetExistingResourceId(requestUrl, resourceType, conditionalQueries, cancellationToken);

if (results == null || results.Count != 1)
if (results == null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be safe, can you add results.Count == 0 to this if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LTA-Thinking Updated the if statement. Please review it.

{
throw new RequestNotValidException(string.Format(Core.Resources.InvalidConditionalReference, reference.Reference));
}
else if (results.Count != 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And could you change this check to be if the count is greater than 1.

Copy link
Member

@brendankowitz brendankowitz Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For conditional, we want exactly 1, my only other thought here was 0 (if thats possible), which would still give the wrong error message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LTA-Thinking , @brendankowitz Updated the if else statement which cover both count = 0 and count >1 condition.

brendankowitz
brendankowitz previously approved these changes Oct 22, 2024
@brendankowitz brendankowitz dismissed their stale review October 22, 2024 15:36

pending question

LTA-Thinking
LTA-Thinking previously approved these changes Oct 23, 2024
@LTA-Thinking
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@v-nikitaraut
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 4691 in repo microsoft/fhir-server

@v-shnarang
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

PTaladay
PTaladay previously approved these changes Dec 6, 2024
@PTaladay PTaladay enabled auto-merge (squash) December 6, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants