Skip to content

Releases: kaptinlin/jsonschema

v0.8.0

05 Jun 14:30

Choose a tag to compare

Localization moved to the optional i18n subpackage

The root package no longer imports any translation framework. Pure validation users pay zero Intl compile, link, and binary cost — 28 transitive packages dropped from the root import graph, and not a single byte of locale data ends up in your binary unless you opt in.

Localization is now opt-in through the consumer-side Translator interface:

type Translator interface {
    Translate(code string, params map[string]any) (message string, ok bool)
}

The i18n subpackage provides the built-in 9-locale implementation (backed by go-i18n); or implement the one-method interface yourself with any backend.

Migration

Before After
jsonschema.I18n() + bundle.NewLocalizer("zh-Hans") i18n.New("zh-Hans") — import github.com/kaptinlin/jsonschema/i18n
err.Localize(localizer) err.Localize(translator)
result.ToLocalizeList(localizer, ...) result.ToLocalizedList(translator, ...)
result.DetailedErrors(localizer) result.LocalizedDetailedErrors(translator)
result.DetailedErrors() unchanged — always English, no arguments
import (
    "github.com/kaptinlin/jsonschema"
    "github.com/kaptinlin/jsonschema/i18n"
)

zh, err := i18n.New("zh-Hans") // one translator per locale; unknown locale errors here
if err != nil { ... }

for path, msg := range result.LocalizedDetailedErrors(zh) {
    fmt.Println(path, msg)
}

Behavior

  • Fallback semantics unchanged: a nil translator or a missing translation falls back to the built-in English message — localization never fails.
  • Same 9 built-in locales: en, de-DE, es-ES, fr-FR, ja-JP, ko-KR, pt-BR, zh-Hans, zh-Hant.
  • i18n.New rejects unknown locales with ErrUnsupportedLocale instead of silently falling back to English.

Dependencies

  • go-i18n upgraded to v0.5.0 (now uses messageformat-go/mf1 v0.7.0).

Full Changelog: v0.7.18...v0.8.0

v0.7.17

04 Jun 08:18

Choose a tag to compare

What's Changed

Security

  • Require Go 1.26.4 so CI and downstream builds use standard-library vulnerability fixes for GO-2026-5037 and GO-2026-5039.

v0.7.15

28 May 11:57

Choose a tag to compare

What's Changed

Changed

  • Updated go-i18n, jsonpointer, the JSON backend, and the upstream JSON Schema Test Suite fixture.
  • Hardened lint and CI verification so dependency maintenance runs with pinned lint tooling and tighter resource limits.

v0.7.14

17 May 06:03

Choose a tag to compare

What's Changed

Changed

  • Streamlined validation, struct object handling, tag parsing, and schemagen internals without changing the public API.
  • Adopted modern Go collection and iteration helpers across internal paths.
  • Updated Go toolchain metadata, golangci-lint, and core library dependencies.
  • Dropped markdownlint tooling from the repository workflow.

Documentation

  • Clarified validation entry points, defaults behavior, and loader safety.