Commit Graph

148 Commits

Author SHA1 Message Date
Johann Schopplich
cdb90585fa test(cli): add tests for invalid values 2025-11-04 10:17:20 +01:00
Johann Schopplich
af298537a4 test(cli): add basic test suite 2025-11-04 07:45:50 +01:00
Thales Gelinger
8f0156c1af docs: add Neovim/Lua implementation (#73) 2025-11-03 18:42:05 +01:00
Johann Schopplich
314497630d chore: release v0.7.3 2025-11-03 17:42:01 +01:00
Marek Madejski
2c872e3cc4 docs: hint at official Python implementation (#69)
* Remove obsolete Python link in README

Removed pytoon, as it has been archived and the development stopped

* docs: add community implementation note

---------

Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
2025-11-03 17:41:31 +01:00
Johann Schopplich
e174c46ba1 fix: add README files to published packages 2025-11-03 17:36:47 +01:00
Johann Schopplich
fecf4409d2 docs: update social card image 2025-11-03 16:14:20 +01:00
Johann Schopplich
3fc9291a8f chore: release v0.7.2 2025-11-03 11:41:37 +01:00
Johann Schopplich
a3b1a01a8b feat(cli): support stdin for input handling (fixes #71) 2025-11-03 11:39:10 +01:00
Johann Schopplich
f08376ca04 chore: release v0.7.1 2025-11-03 08:23:13 +01:00
Johann Schopplich
6e9519db3a refactor: remove unused comments 2025-11-03 08:19:57 +01:00
Wind
e414ca3671 fix: handle empty list items and nested objects in list items (#65)
* fix: support quoted keys with array syntax

Fixes parsing of quoted keys followed by array syntax like:
"x-codeSamples"[1]{lang,label,source}:

Previously, parseArrayHeaderLine would skip any line starting with
a quoted key. This caused large OpenAPI specs (like Hetzner Cloud API)
to fail decoding.

Changes:
- Modified parseArrayHeaderLine to handle quoted keys
- Added logic to find bracket start after closing quote
- Unescape quoted keys properly
- Added 3 test cases for the new functionality

Closes #62

* fix: handle empty list items and nested objects in list items

This commit fixes two critical decoder bugs that prevented complex
OpenAPI specs (like DigitalOcean's 638 schemas) from being decoded:

1. Empty list items: Items encoded as just `-` (without space) were
   not recognized. The decoder only checked for `LIST_ITEM_PREFIX = '- '`.
   Fixed by adding check for both `- ` and `-` patterns.

2. Nested objects in list items: When a list item contains an object
   with nested properties (e.g., `allOf[2]: - properties: state: ...`),
   the decoder was looking for nested content at the wrong depth level.
   List items add one level of indentation, so nested content should be
   at baseDepth + 2, not baseDepth + 1.

   Fixed by creating `decodeKeyValueForListItem()` that correctly handles
   the extra nesting while maintaining proper followDepth for siblings.

Changes:
- Added `decodeKeyValueForListItem()` function to handle list item nesting
- Updated `decodeObjectFromListItem()` to use new function
- Added empty item detection in `decodeListArray()`
- Added comprehensive unit tests for both bugs
- Added integration test with real DigitalOcean OpenAPI spec (638 schemas)
- Gitignored large fixture files, added README with download instructions

Tests:
- 5 new unit tests in list-item-bugs.test.ts
- 1 integration test in digitalocean-decode.test.ts (skips if fixture missing)
- All 309 existing tests still pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* perf: calculate depth on demand

* chore: move tests to test suite

* chore: test against new tests

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
2025-11-03 08:18:14 +01:00
Johann Schopplich
cfc3dadb21 docs: update gray color 2025-11-03 08:03:47 +01:00
Johann Schopplich
244429dc8f ci: fix fetch depth for changelog generation 2025-11-02 21:54:59 +01:00
Johann Schopplich
cf31d1087d ci: fix fetch depth for changelog generation 2025-11-02 21:49:40 +01:00
Morteza Hosseini
c3db2a138c ci: update CI configuration for improved caching and dependency management (#63)
* build: update CI configuration for improved caching and dependency management

* build: ensure newline at end of file in CI configuration
2025-11-02 18:49:00 +01:00
Johann Schopplich
c1527dcf80 chore: fix type issue 2025-11-02 18:34:00 +01:00
Johann Schopplich
8977c8c7d6 feat: use language-agnostic test suite 2025-11-02 18:31:06 +01:00
Johann Schopplich
662a9d4bc5 feat: move SPEC to @toon-format/spec 2025-11-02 18:30:36 +01:00
David Sancho
7bb5dfb10c docs: add OCaml implementation (#57) 2025-11-01 22:15:32 +01:00
Johann Schopplich
da0a0b9be3 chore: release v0.7.0 2025-11-01 17:28:24 +01:00
Johann Schopplich
5f09a14c61 chore: fix type issues 2025-11-01 17:15:37 +01:00
Johann Schopplich
0710bd19e7 feat!: publish to @toon-format/toon and @toon-format/cli 2025-11-01 16:53:41 +01:00
Johann Schopplich
8bcbdb7315 docs: enhance explanation for TOON format benefits (related to #49) 2025-11-01 07:53:48 +01:00
Johann Schopplich
b8140ce053 chore: release v0.6.0 2025-11-01 00:37:53 +01:00
Johann Schopplich
8567df9131 fix(cli): inline tokenx 2025-11-01 00:37:11 +01:00
SangheeSon
2b882870f7 feat(cli): add --stats flag to show token savings (#51)
* feat(cli): add --stats flag to show token efficiency

- Add --stats boolean flag to display token count comparison
- Calculate approximate tokens using char length / 4 heuristic
- Show JSON vs TOON token counts with savings percentage
- Opt-in feature, default behavior unchanged

* feat: use tokenx for more accurate estimates

---------

Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
2025-11-01 00:35:54 +01:00
Anton Maminov
af068f995d docs: add Crystal implementation (#48) 2025-11-01 00:26:43 +01:00
Johann Schopplich
901fcc53f3 docs(spec): add main title 2025-10-31 22:13:20 +01:00
Morteza Hosseini
baf450b46c docs: update README with badges for CI, npm version, spec, downloads, and license (#52) 2025-10-31 19:48:54 +01:00
Johann Schopplich
5a2040ae81 docs(spec): release v1.3 2025-10-31 13:52:18 +01:00
Johann Schopplich
617e5f1bda docs(spec): more work on v1.3 draft 2025-10-31 13:23:55 +01:00
Johann Schopplich
9f926c4de1 docs(spec): v1.3 draft 2025-10-31 13:13:02 +01:00
Johann Schopplich
bb1f61030e test: add test for precision preservation of repeating decimals 2025-10-31 12:40:15 +01:00
Johann Schopplich
bf592b0bba docs(spec): better RFC/W3C compliance 2025-10-31 12:06:24 +01:00
Johann Schopplich
8c8c654a32 docs(spec): update acknowledgments and license section 2025-10-31 11:50:45 +01:00
Johann Schopplich
fe8f0615df docs: merge installation and quick start 2025-10-31 09:27:31 +01:00
Johann Schopplich
13351a365a docs: add rtoon as Rust implementation (closes #41) 2025-10-31 09:10:22 +01:00
Johann Schopplich
a3bf1965c6 docs: add implementation note 2025-10-31 09:04:19 +01:00
Johann Schopplich
753ee2cefd docs: add table of contents 2025-10-31 08:56:42 +01:00
Johann Schopplich
b2eeaea9d0 docs: add Gleam port (fixes #44) 2025-10-30 21:58:14 +01:00
Johann Schopplich
3a48cd4c7c docs: add Dart port (fixes #42) 2025-10-30 21:57:03 +01:00
Johann Schopplich
66212285e5 refactor(cli): re-use source constants 2025-10-30 21:33:08 +01:00
Johann Schopplich
7317b869b1 docs: update benchmark README 2025-10-30 17:38:00 +01:00
Johann Schopplich
983728e913 refactor: progress bar configuration 2025-10-30 15:24:22 +01:00
Johann Schopplich
fb43bdf527 docs: adjust padding for benchmark comparison 2025-10-30 15:19:16 +01:00
Johann Schopplich
2c4f3c4362 test: add benchmarks for compact vs. pretty JSON 2025-10-30 15:02:51 +01:00
Johann Schopplich
df68417d8b docs: remove redundant canonical formatting rules section 2025-10-30 12:45:16 +01:00
Johann Schopplich
858797f186 docs: update social card image 2025-10-30 12:45:00 +01:00
Johann Schopplich
b93714e9b9 refactor: move gpt-tokenizer to benchmarks 2025-10-30 09:27:11 +01:00