1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-02-19 21:54:45 +01:00
json-machine/CHANGELOG.md

201 lines
7.4 KiB
Markdown
Raw Normal View History

2020-12-05 15:13:00 +01:00
# Changelog
2020-11-09 12:37:28 +01:00
2022-02-04 16:04:39 +01:00
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<br>
2020-12-05 15:13:00 +01:00
## master
2024-11-03 16:42:32 +01:00
### Fixed
- Wrong key when combining list and scalar value pointers (#110). Thanks [@daniel-sc](https://github.com/daniel-sc)
2023-11-28 22:12:40 +01:00
<br>
## 1.1.4 - 2023-11-28
2023-11-28 19:18:26 +01:00
- Minor fixes and added some tests.
### Added
- Support for PHP 8.3
- Added PHPStan to build pipeline
### Fixed
2024-10-11 21:30:42 +02:00
- Fixed the case when non-intersecting pointers were considered intersecting (#106). Thanks [@XedinUnknown](https://github.com/XedinUnknown)
2022-10-12 13:40:33 +02:00
<br>
## 1.1.3 - 2022-10-12
2022-10-10 14:23:55 +02:00
### Fixed
2024-10-11 21:30:42 +02:00
- Fix the parsing of nested sub-trees that use wildcards (#83). Thanks [@cerbero90](https://github.com/cerbero90)
2022-09-29 17:12:17 +02:00
<br>
## 1.1.2 - 2022-09-29
2022-09-29 16:52:10 +02:00
### Added
- PHP 8.2 support
### Fixed
- Meaningful error on invalid token. (#86)
- Added missing return type annotation. (#84)
2022-02-19 22:00:16 +01:00
<br>
2022-03-03 12:02:11 +01:00
## 1.1.1 - 2022-03-03
### Fixed
- Fixed warning when generating autoload classmap via composer.
<br>
2022-02-19 22:00:16 +01:00
## 1.1.0 - 2022-02-19
2022-02-12 16:01:13 +01:00
### Added
2024-10-11 21:30:42 +02:00
- Autoloading without Composer. Thanks [@a-sync](https://github.com/a-sync).
2022-02-03 20:26:15 +01:00
2022-02-04 16:04:39 +01:00
<br>
## 1.0.1 - 2022-02-06
### Fixed
- Broken command `make performance-tests`
- Slight performance improvements
<br>
2022-02-04 16:04:39 +01:00
## 1.0.0 - 2022-02-04
2022-01-08 15:18:22 +01:00
### Removed
- Removed deprecated functions `objects()` and `httpClientChunks()`.
- Removed deprecated `JsonMachine` entrypoint class. Use `Items` instead.
- Removed deprecated `Decoder` interface. Use `ItemDecoder` instead.
- Removed `Parser::getJsonPointer()`. Use `Parser::getJsonPointers()`/`Items::getJsonPointers()` instead.
- Removed `Parser::getJsonPointerPath()`. No replacement. Was not useful for anything other than testing and exposed internal implementation.
### Changed
2022-02-04 16:04:39 +01:00
#### Simplified and fixed decoding
- JSON Pointer parts between slashes (a.k.a reference tokens) must be valid encoded JSON strings to be [JSON Pointer RFC 6901](https://tools.ietf.org/html/rfc6901) compliant.
2022-02-03 13:43:25 +01:00
It means that no internal key decoding is performed anymore. You will have to change your JSON Pointers if you match against keys with escape sequences.
2022-01-31 13:56:13 +01:00
```diff
Items::fromString(
'{"quotes\"": [1, 2, 3]}',
- ['pointer' => '/quotes"']
+ ['pointer' => '/quotes\"']
);
```
- Method `ItemDecoder::decodeInternalKey()` was deleted as well as related `ValidStringResult`.
They are not used anymore as described in previous point.
2022-02-03 20:26:15 +01:00
- `PassThruDecoder` does not decode keys anymore. Both the key and the value yielded are raw JSON now.
#### Other
- Default decoding structure of `Parser` is object. (You won't notice that unless you use `Parser` class directly)
- `SyntaxError` renamed to `SyntaxErrorException`
- `Items::__construct` accepts the options array instead of separate arguments. (You won't notice that unless you instantiate `Items` class directly)
2022-02-03 16:14:17 +01:00
- `Lexer` renamed to `Tokens`
- `DebugLexer` renamed to `TokensWithDebugging`
2022-01-22 21:34:25 +01:00
### Added
2024-10-11 21:30:42 +02:00
- Multiple JSON Pointers can be specified as an array in `pointer` option. See README. Thanks [@fwolfsjaeger](https://github.com/fwolfsjaeger).
2022-01-22 21:34:25 +01:00
- New methods available during iteration: `Items::getCurrentJsonPointer()` and `Items::getMatchedJsonPointer()`
2024-10-11 21:30:42 +02:00
to track where you are. See README. Thanks [@fwolfsjaeger](https://github.com/fwolfsjaeger).
2022-01-22 21:34:25 +01:00
2022-02-04 15:33:15 +01:00
### Fixed
- Incorrect position information of `TokensWithDebugging::getPosition()`. Was constantly off by 1-2 bytes.
2021-12-24 12:51:10 +01:00
<br>
2022-01-07 16:21:59 +01:00
## 0.8.0
### Changed
2022-01-08 15:18:22 +01:00
- Internal decoders moved to `ItemDecoder`. `ErrorWrappingDecoder` decorator now requires `ItemDecoder` as well.
2022-01-08 15:35:29 +01:00
- Dropped PHP 5.6 support.
2022-01-08 15:18:22 +01:00
### Deprecated
2021-12-23 13:52:18 +01:00
- `JsonMachine\JsonMachine` entry point class is deprecated, use `JsonMachine\Items` instead.
2022-01-08 15:18:22 +01:00
- `JsonMachine\JsonDecoder\Decoder` interface is deprecated. Use `JsonMachine\JsonDecoder\ItemDecoder` instead.
2021-12-21 15:28:55 +01:00
### Added
2021-12-22 14:44:19 +01:00
- New entry point class `Items` replaces `JsonMachine`.
2021-12-22 21:09:55 +01:00
- Object as default decoding structure instead of array in `Items`.
- `Items::getIterator()` now returns `Parser`'s iterator directly. Call `Items::getIterator()`
instead of `JsonMachine::getIterator()::getIterator()` to get to `Parser`'s iterator if you need it. Fixes
https://stackoverflow.com/questions/63706550
2022-01-07 16:21:59 +01:00
- `Items` uses `options` in its factory methods instead of growing number of many parameters. See **Options** in README.
- `Items` introduces new `debug` option. See **Options** in README.
- Noticeable performance improvements. What took 10 seconds in `0.7.*` takes **about** 7 seconds in `0.8.0`.
2022-02-04 16:04:39 +01:00
2021-12-06 14:33:35 +01:00
<br>
## 0.7.1
### New features
2021-11-26 23:10:27 +01:00
- PHP 8.1 support
- DEV: Build system switched to composer scripts and Makefile
2021-05-06 13:47:56 +02:00
<br>
## 0.7.0
### New features
2024-10-11 21:30:42 +02:00
- Use a `-` in json pointer as a wildcard for an array index. Example: `/users/-/id`. Thanks [@cerbero90](https://github.com/cerbero90)
2021-01-24 20:08:30 +01:00
<br>
## 0.6.1
### Fixed bugs
- Empty dict at the end of an item was causing Syntax error in the next item. Reason: closing `}` did not set object key expectation to `false`. (#41 via PR #42).
<br>
2021-01-24 20:08:30 +01:00
## 0.6.0
2020-12-15 17:45:37 +01:00
### New features
- **New:** Json pointer can find scalar values in JSON document as well as iterable values. See
[Getting single scalar values](README.md#getting-scalar-values)
- Parser ends when the end of the desired data is reached and does not heat up the atmosphere further.
2021-01-12 21:47:10 +01:00
- Optimizations: about 15% speed gain.
2020-12-08 16:41:49 +01:00
2020-12-15 17:45:37 +01:00
### BC breaks
- A json pointer that matches scalar value does not throw anymore, but the scalar value is yielded in foreach.
2020-12-08 16:41:49 +01:00
<br>
## 0.5.0
2020-12-05 15:13:00 +01:00
### New features
- Introduced `FileChunks` class. Takes care of the proper resource management when iterating via `JsonMachine::fromFile()`.
It is used internally, and you probably won't come across it.
2020-12-08 16:37:36 +01:00
- New `ErrorWrappingDecoder`. Use it when you want to skip malformed JSON items. See [Decoders](README.md#decoders).
2020-12-05 15:13:00 +01:00
### BC breaks
- `StreamBytes` and `StringBytes` renamed to `StreamChunks` and `StringChunks`.
These are internal classes, and you probably won't notice the change
unless you use them directly for some reason.
2020-11-12 16:16:40 +01:00
<br>
2020-11-09 12:37:28 +01:00
2020-12-05 15:13:00 +01:00
## 0.4.1
### New features
2020-12-01 20:53:49 +01:00
- Tracking of parsing progress
2020-12-01 20:58:22 +01:00
<br>
2020-12-05 15:13:00 +01:00
## 0.4.0
### New features
2020-12-08 12:56:58 +01:00
- [Decoders](README.md#decoders)
2024-10-11 21:30:42 +02:00
- PHP 8 support (thanks [@snapshotpl](https://github.com/snapshotpl))
2020-12-05 15:13:00 +01:00
### BC breaks
2020-11-09 12:37:28 +01:00
- `ext-json` is not required in `composer.json` anymore, because custom decoder might not need it.
However **built-in decoders depend on it** so it must be present if you use them.
2024-10-11 21:30:42 +02:00
- All exceptions now extend `JsonMachineException` (thanks [@gabimem](https://github.com/gabimem))
- Throws `UnexpectedEndSyntaxErrorException` on an unexpected end of JSON structure (thanks [@gabimem](https://github.com/gabimem))
2020-04-17 13:08:40 +02:00
- Function `httpClientChunks()` is **deprecated** so that compatibility with Symfony HttpClient
2020-11-08 12:55:44 +01:00
is not on the shoulders of JSON Machine maintainer. The code is simple and everyone can make their own
2022-01-27 20:22:36 +01:00
function and maintain it. The code was moved to [examples](examples/symfonyHttpClient.php).
2020-04-17 13:08:40 +02:00
- Function `objects()` is **deprecated**. The way `objects()` works is that it casts decoded arrays
to objects. It brings some unnecessary overhead and risks on huge datasets.
2020-11-08 12:55:44 +01:00
Alternative is to use `ExtJsonDecoder` which decodes items as objects by default (same as `json_decode`).
2020-04-17 13:08:40 +02:00
```php
<?php
use JsonMachine\JsonDecoder\ExtJsonDecoder;
use JsonMachine\JsonMachine;
2020-04-17 13:08:40 +02:00
$jsonMachine = JsonMachine::fromFile('path/to.json', '', new ExtJsonDecoder);
2020-04-17 13:08:40 +02:00
```
Therefore no additional casting is required.
2020-04-17 12:43:32 +02:00
- Invalid json object keys will now throw and won't be ignored anymore.
2020-12-05 15:13:00 +01:00
### Fixed bugs
2020-04-17 12:43:32 +02:00
- Decoding of json object keys checks for errors and does not silently ignore them.