Skip to content

SUSHI constrains too much when type constraining to a choice of resource and a profile of that resource #1564

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

Open
cmoesel opened this issue Apr 11, 2025 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cmoesel
Copy link
Member

cmoesel commented Apr 11, 2025

Given:

* identifier only Identifier or MyIdentifier

SUSHI produces the type:

"type": [
  {
    "code": "Identifier",
    "profile": [
      "http://example.org/StructureDefinition/MyIdentifier"
    ]
  }
],

FSH Online Link

This is incorrect because any Identifier should be allowed, but the constraint SUSHI outputs requires instances to conform to MyIdentifier profile.

The correct behavior should be either a no-op (because the adding the profile to the choice is meaningless since all Identifiers are allowed) or should list the canonical for the resource in the profile array (which more closely aligns with what the user asked for):

"type": [
  {
    "code": "Identifier",
    "profile": [
      "http://hl7.org/fhir/StructureDefinition/Identifier",
      "http://example.org/StructureDefinition/MyIdentifier"
    ]
  }
],

See: #shorthand > Issue specifying two types, one not rendered @ 💬

@cmoesel cmoesel added bug Something isn't working good first issue Good for newcomers labels Apr 11, 2025
@Teruk15
Copy link

Teruk15 commented Apr 11, 2025

Hello, @cmoesel may I work on this?

@cmoesel
Copy link
Member Author

cmoesel commented Apr 12, 2025

Hi @Teruk15. Yes, absolutely! See the SUSHI README Developer Instructions for core information about SUSHI development. We also have files on contributing, best practices, and code of conduct in the root of the repository.

Thanks for offering to help. I look forward to you PR. Let me know if you run into any issues. I marked this as a "good first issue" based on my recollection of the code -- but it's always possible that it might turn out more complicated than expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants