firely-net-sdk icon indicating copy to clipboard operation
firely-net-sdk copied to clipboard

Some Enumerations and properties are not generated properly

Open marcovisserFurore opened this issue 2 years ago • 3 comments

Describe the bug Reported by @Rob5045:

Some properties and enumeration types are not generated properly by the code generator. It concerns the following elements:

STU3

Enum Types: (starting with lowercase)

  • Sequence.qualityType
  • Sequence.repositoryType

Properties: (ending with underscore)

  • Claim.Use_
  • TestScript.OperationComponent.ContentType_

R4

Enum Types: (starting with lowercase)

  • messageheader_response_request
  • MolecularSequence.orientationType
  • MolecularSequence.qualityType
  • MolecularSequence.repositoryType
  • MolecularSequence.sequenceType
  • MolecularSequence.strandType

Properties: (ending with underscore)

  • EffectEvidenceSynthesis.ResultsByExposureComponent.Exposure_
  • VerificationResult.Status_

R4B

Enum Types: (starting with lowercase)

  • messageheader_response_request
  • MolecularSequence.orientationType
  • MolecularSequence.qualityType
  • MolecularSequence.repositoryType
  • MolecularSequence.sequenceType
  • MolecularSequence.strandType
  • VerificationResult.status

Properties: (ending with underscore)

  • Composition.Confidentiality_
  • EvidenceVariable.CharacteristicCombination_
  • ResearchElementDefinition.VariableType_
  • VerificationResult.Status_

R5

Enum Types: (starting with lowercase)

  • messageheader_response_request
  • MolecularSequence.orientationType
  • MolecularSequence.qualityType
  • MolecularSequence.repositoryType
  • MolecularSequence.sequenceType
  • MolecularSequence.strandType
  • VerificationResult.status

Properties: (ending with underscore)

  • Composition.Confidentiality_
  • EvidenceVariable.CharacteristicCombination.GroupMeasure_
  • VerificationResult.Status_

Version used:

  • FHIR Version: STU3, R4, R4B and R5
  • Version: 4.2.1

Changing these elements would introduce breaking changes!

marcovisserFurore avatar Sep 01 '22 08:09 marcovisserFurore

After refinement 2022-09-08:

  • we should change codegen so we generate the correct types and properties
  • the existing incorrect properties and enum will be retained and flagged as obsolete (move them to a separate partial class).

marcovisserFurore avatar Sep 08 '22 11:09 marcovisserFurore

Note that Gino is updating his latest codegen so it does no longer produce breaking changes in the generated C# code, so we should try to apply this fix to the newest codegen.

ewoutkramer avatar Oct 03 '22 13:10 ewoutkramer

Can you check the codegen branch that I was working on to generate R5 and see if that can be merged into.

brianpos avatar Oct 03 '22 22:10 brianpos

There were two issues here:

  • Some HL7 workgroups give their valuesets a ValueSet.name with a lower character (so using lowerCaps), I have made sure we will always use PascalCase.
  • Some valuesets have the same names as the property. This is not possible if the enum is defined inside the same class that declares the property. In this case, the generator automatically adds a "_" to the end of the property. I have changed the behaviour of the generator, so it will now throw an Exception if this happens. There is a variable _enunNamesOverride in the generator that you can extend to define a better/more unique name for the enum to avoid these nameclashes. It's too hard to automate it.
  • The exception thrown will contain the valueset url that you need to specify in _enumNamesOverride.

ewoutkramer avatar Dec 12 '22 16:12 ewoutkramer