Skip to content

Support .sql files (application/sql) for ig-loader content attachments #1323

Description

@johngrimes

When authoring SQL on FHIR SQLView and SQLQuery Library resources, it would be very helpful to attach the SQL from a separate file using the existing ig-loader- mechanism, the same way CQL content IGs attach .cql files. That keeps the SQL editable and reviewable as a plain file rather than hand-encoded base64 in the resource.

At the moment this does not quite work for SQL. AdjunctFileLoader.determineContentType() recognises pdf, dicom, png, gif, jpeg, cql, feature, json, xml, text and txt, but not sql, so it returns null and content.contentType is never set. The SQL on FHIR SQLView/SQLQuery profiles require content.contentType to be present and to start with application/sql (their sql-must-be-sql-expressions invariant), so a loaded .sql attachment fails validation. And because checkReplaceable() only fires when the attachment has no contentType preset, it is not possible to set application/sql by hand and still use the loader.

Would you consider adding a mapping from the sql extension to application/sql in determineContentType()? That single addition would let SQLView and SQLQuery Libraries reference their SQL via content.id = ig-loader-<file>.sql and have the publisher base64-encode it with the correct content type, mirroring the CQL workflow and avoiding hand-maintained base64.

Reference: org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/loaders/AdjunctFileLoader.java, method determineContentType().

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApprovedChange has been reviewed and accepted and can now be applied to the templatesenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions