Releases: piprate/json-gold
v0.7.0
What's Changed
- feat: improve performance and type-safety by @michaeladler in #83
- perf: improve n-quad parser using map-based lookups by @michaeladler in #84
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 asmap[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.
- This change affects all code accessing term definitions via
-
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.
- Direct map access (e.g.,
-
Method Signatures and Return Types
Many methods that previously returnedmap[string]interface{}
now return*TermDefinition
or typed values (likestring
).- Example:
func (c *Context) GetTermDefinition(key string) map[string]interface{}
is nowfunc (c *Context) GetTermDefinition(key string) *TermDefinition
- Example:
-
Removed/Changed Utility Functions
GetKeysString
removed; replaced by a genericGetKeys[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
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
- @reinkrul made their first contribution in #64
- @suutaku made their first contribution in #67
- @olomix made their first contribution in #78
- @michaeladler made their first contribution in #82
Full Changelog: v0.5.0...v0.6.0
v0.5.0
v0.4.2
v0.4.1
v0.4.0
v0.3.0
v0.2.0
- 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
Maintainer change
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.