Skip to content

Releases: piprate/json-gold

v0.7.0

14 Jul 21:41
3fbc0ad
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.6.0...v0.7.0

Backward Compatibility Impact

This release replaces map-based context and term definitions with strongly typed structs, which significantly improves performance and type safety but will break client code that relies on the previous map-based interfaces. All such code must be updated to use the new struct fields and method signatures. Utility functions have also been updated to use generics.

  • Code using direct field access or map keys on context/term definitions will break.
  • Any code relying on the return type of context methods being a map will need to be updated to handle the new struct.
  • Code using utility functions for maps may need updates due to the use of generics and removal of concrete-typed functions.

See the detailed overview of breaking changes below.

1. Context API: Major Changes

  • Term Definitions
    Term definitions previously stored as map[string]interface{} are now represented by a dedicated *TermDefinition struct.

    • This change affects all code accessing term definitions via Context.termDefinitions or related methods.
    • Methods such as GetTermDefinition, GetTypeMapping, GetLanguageMapping, GetDirectionMapping, GetContainer, and others now return or expect a *TermDefinition struct instead of a generic map.
  • Context values
    Context-wide values (like @base, @language, @vocab, etc.) are now stored in a *Values struct, replacing the previous map-based approach (Context.values).

    • Direct map access (e.g., ctx.values["@language"]) will not work anymore; code must use the struct fields.
  • Method Signatures and Return Types
    Many methods that previously returned map[string]interface{} now return *TermDefinition or typed values (like string).

    • Example:
      • func (c *Context) GetTermDefinition(key string) map[string]interface{}
        is now
      • func (c *Context) GetTermDefinition(key string) *TermDefinition
  • Removed/Changed Utility Functions

    • GetKeysString removed; replaced by a generic GetKeys[T any](m map[string]T) []string.
    • Code depending on GetKeysString must switch to the new generic function.

2. Struct Field Access

  • Any client code that directly accesses context and term definition fields as maps (e.g., definition["@type"]) must now use struct fields (e.g., definition.typ).
  • This applies to all usages, including @reverse, @container, @type, @language, @direction, @index, @context, etc.

3. Method Changes

  • Methods like GetContainer, HasContainerMapping, GetTypeMapping, GetLanguageMapping, GetDirectionMapping have type changes in their signatures and return values.
  • GetContainer now returns []string instead of []interface{}.

4. Example of Breaking Change

Old (v0.6.0):

td := ctx.GetTermDefinition("someTerm")
typ := td["@type"].(string)

New (v0.7.0):

td := ctx.GetTermDefinition("someTerm")
typ := td.typ

v0.6.0

28 May 22:27
Compare
Choose a tag to compare

What's Changed

  • Bugfix: copy SafeMode in JsonLdOptions.Copy by @reinkrul in #64
  • Add CodeCov workflow step by @kazarena in #65
  • context.parse now returns underlying document loader error by @reinkrul in #66
  • should return serializer error by @suutaku in #67
  • Bump github.com/stretchr/testify from 1.8.1 to 1.8.3 by @dependabot in #72
  • Fix #76: Nested @context definition returns an error by @kazarena in #77
  • Fix GetCanonicalDouble for values between -1 and +1 by @olomix in #78
  • feat: add optimization for finding the best CURIE by @michaeladler in #82

New Contributors

Full Changelog: v0.5.0...v0.6.0

v0.5.0

18 Nov 09:33
Compare
Choose a tag to compare

This release includes:

  • Add GitHub workflows for CI
  • Bump the package to Go 1.18
  • Address linter feedback, including regexes
  • New option: Safe Mode. If set to true, Expansion operation will fail if it encounters properties that aren't defined in the context

v0.4.2

04 Oct 17:33
Compare
Choose a tag to compare
  • Move initialization of rxURL from global to function scope to reduce stack size usage while initialization (#58)

v0.4.1

20 Dec 08:55
33b90c4
Compare
Choose a tag to compare
  • Bug fix: float to int conversion in 32-bit systems while transforming object to RDF (#51)
  • Performance improvements for processing big documents (#52)

v0.4.0

03 Mar 22:15
0b11d17
Compare
Choose a tag to compare
  • Partial support for JSON literals (@json)
  • Performance improvements
  • Minor bug fixes

v0.3.0

09 Jan 00:25
0dbcf4d
Compare
Choose a tag to compare
  • Substantial conformance to the latest W3C Recommendation for JSON-LD 1.1 specification.
  • Default processing mode set to JSON-LD 1.1

v0.2.0

16 Jan 17:12
cf8c697
Compare
Choose a tag to compare
  • JSON 1.1 support
    • Breaking interface change: JsonLdOptions.Embed is now string (used to be bool)
  • Do not use native types to create IRIs in value expansion.
  • Improve acceptable N-Quads blank node labels.
  • Compact the @context array if it contains a single element
  • Fix a bug which omitted the context if provided in a URL form
  • Provide error message when output form for FromRDF operation is unknown
  • Pass array compaction flag to compaction inside of framing

v0.1.1

12 Dec 12:08
d835a9c
Compare
Choose a tag to compare
  • RFC7324 compliant caching
  • Go 1.11 module support

Maintainer change

24 Dec 11:42
Compare
Choose a tag to compare

Copy the original library under the following terms:

  • @piprate team will be the maintainer of the new library
  • The original repo will remain available
  • Interfaces of the new library will be preserved, but may deviate in future versions
  • Licensing will not change
  • Past contributors will be recognised
  • Commit history will not be preserved in the new library
  • Versions of the new library will be reset

See the full announcement here.