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

Add Source generation for custom resources #140

Open
almostchristian opened this issue Aug 9, 2023 · 2 comments · May be fixed by #147
Open

Add Source generation for custom resources #140

almostchristian opened this issue Aug 9, 2023 · 2 comments · May be fixed by #147
Labels
core Related to the core functionality, not language specific enhancement New feature or request

Comments

@almostchristian
Copy link

almostchristian commented Aug 9, 2023

My company is looking into using more and more custom FHIR resources, So I'm looking to develop a source generator to auto generate the resource code based on the structure definition. My idea is that it will look for files with a name that ends with .StructureDefinition.json and then generate code from those files.

I tried my hand in this but I think this could work.
image

I'm currently working on this branch:
https://github.com/almostchristian/fhir-codegen/tree/feature/sourcegen

Some issues that I'm looking to resolving:

  • change namespace to be the same as the <assemblyname>.<folder.path> instead of the constant namespace. This should be a simple change. supported in latest change
  • nested enum and generic Code<T> property generation, I'm still trying to figure out how to get this to work. supported in latest change
@GinoCanessa GinoCanessa added enhancement New feature or request core Related to the core functionality, not language specific labels Aug 15, 2023
@GinoCanessa
Copy link
Contributor

Just wanted to comment that I have reviewing this on my list for next week. Thanks for the work so far!

@almostchristian
Copy link
Author

I tried this for one of my sample projects which uses v4.3.0 of the Firely libraries and ran into issues related to the changes introduced in the latest 5.x Firely libraries (specifically the change in the FhirEnumerationAttribute).

image

If this source generator is to be publicly released, should we make the generated code adapt to the version of the Firely library? Or do we tie it to a specific/latest version available? The source generator library itself does not reference the Firely library, and this could lead to mistakes like what I encountered.

image

@almostchristian almostchristian linked a pull request Oct 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the core functionality, not language specific enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants