Skip to content

High-performance FHIR 
validation for Go

Validate FHIR R4, R4B, and R5 resources against StructureDefinitions, profiles, and terminology 
with a fast, embeddable Go library and CLI tool.

Quick Start

Requires Go 1.23 or later.

Install the validator:

go get github.com/gofhir/validator

Validate a FHIR resource:

package main

import (
    "fmt"

    "github.com/gofhir/validator"
)

func main() {
    v := validator.New()
    result := v.ValidateFile("patient.json")

    for _, issue := range result.Issues() {
        fmt.Printf("[%s] %s: %s\n", issue.Severity, issue.Expression, issue.Diagnostics)
    }
}

Or use the CLI:

gofhir-validator patient.json
Read the full guide