Update on 2025-01-21 to add configuration for Zed
I often create proof-of-concept FHIR resources by hand in VS Code—especially for terminological resources, creating a simple resource is often faster than using SUSHI, my own BabelFSH tool, or something else entirely, but a bit of assistance would be helpful.
Turns out you can add JSON schemas to VS code and Zed to get better code completion and validation for FHIR resources. Downloading the JSON schemas from the FHIR spec is easy enough, but how to put them into VS Code? That’s where this website comes in. By uploading the schema files to the page, I get a convenient download link, so that I can simply point VS code or Zed there.
Since I mainly need the FHIR R4 schemas, I have made those the default. Adjust as needed. Happy hacking!
VS Code Setup
Open the user settings in JSON format using the Preferences: Open User Settings (JSON) command (this could of course also be done in the workspace settings) and add something like the following:
{
"json.schemas": [
{
"fileMatch": ["*.fhir.json*", "*.fhir-r4.json*"],
"url": "https://wiedekopf.net/data/fhir-r4.schema.json"
},
{
"fileMatch": ["*.fhir-r4b.json"],
"url": "https://wiedekopf.net/data/fhir-r4b.schema.json"
},
{
"fileMatch": ["*.fhir-r5.json"],
"url": "https://wiedekopf.net/data/fhir-r5.schema.json"
}
]
}
Zed setup
Zed is configured in a JSON file, either on a global or a per-project level.
For the global settings, open the settings file using the zed: open settings
action, and add a section like the following:
{
// snip
"lsp": {
"json-language-server": {
"settings": {
"json": {
"schemas": [
{
"fileMatch": ["*/*.fhir.json*", "*/*.fhir-r4.json*"],
"url": "https://wiedekopf.net/data/fhir-r4.schema.json"
},
{
"fileMatch": ["*/*.fhir-r4b.json"],
"url": "https://wiedekopf.net/data/fhir-r4b.schema.json"
},
{
"fileMatch": ["*/*.fhir-r5.json"],
"url": "https://wiedekopf.net/data/fhir-r5.schema.json"
}
]
}
}
}
}
}
URIs
For reference: The following files are currently hosted at this site: