Commit Graph

39 Commits

Author SHA1 Message Date
Johann Schopplich
327bddae55 feat: parse nested tabular arrays in list items with bare hyphen (spec v2.1) 2025-11-24 08:42:30 +01:00
Johann Schopplich
7a05d03e73 test(cli) add streaming events coverage 2025-11-22 08:53:47 +01:00
Johann Schopplich
8d9b486485 chore: release v1.3.0 2025-11-21 22:38:59 +01:00
Johann Schopplich
6c57a14009 feat: streaming decode functionality with event-based parsing (closes #131) 2025-11-21 22:29:57 +01:00
Johann Schopplich
9ebad53ea3 feat(cli): stream output for both encoding and decoding 2025-11-21 16:52:34 +01:00
Johann Schopplich
cfbbb09358 chore: release v1.2.0 2025-11-21 14:03:40 +01:00
Johann Schopplich
1c003c6118 feat(cli): memory-efficient streaming for encoding 2025-11-21 14:02:22 +01:00
Johann Schopplich
be8bcfe9b2 chore: release v1.1.0 2025-11-21 09:36:25 +01:00
Johann Schopplich
36ddd2e0ea fix: encode mixed-format arrays at root level (fixes #202) 2025-11-21 09:01:26 +01:00
Johann Schopplich
2e992aed74 feat: encodeLines for streaming encoding to TOON 2025-11-20 18:37:46 +01:00
Johann Schopplich
4b4f7c05f9 docs: add dedicated docs website 2025-11-18 07:23:10 +01:00
cy
f798bba095 test(cli): add tests for stdin input (#107)
* test(cli): add tests for stdin input

* test(cli): extract mock stdin to helper function

* test(cli): add comprehensive tests for stdin edge cases and output file handling

* refactor(test): streamline mockStdin function and relocate to utils

* test(cli): remove redundant test for JSON encoding from stdin

* test(cli): restore mocks consistently

* test(cli):  restructured output file tests and modified some assertions

* chore: fix linting issues & remove redundant cleanups

---------

Co-authored-by: mad-cat-lon <113548315+mad-cat-lon@users.noreply.github.com>
Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
2025-11-11 17:35:52 +01:00
Johann Schopplich
0a4c89e496 refactor: move function internally 2025-11-11 17:24:18 +01:00
Johann Schopplich
2e7a27c3c0 chore: upgrade tsdown 2025-11-11 09:31:17 +01:00
Johann Schopplich
b2782b026f chore: release v1.0.0 2025-11-10 17:29:05 +01:00
Johann Schopplich
e8ae024e54 feat!: remove optional length marker option [#N] in favor of [N] 2025-11-10 17:28:49 +01:00
Johann Schopplich
1c74f09177 chore: fix linting error 2025-11-10 14:34:13 +01:00
Johann Schopplich
1837007048 perf: improve empty object checks 2025-11-10 14:30:54 +01:00
Johann Schopplich
661dcbe5f8 docs: clarify spec v1.5 changes 2025-11-10 13:21:25 +01:00
Johann Schopplich
ac17a8d260 refactor: misc. clean ups (removing unnecessary comments, improving variable names) 2025-11-10 13:19:33 +01:00
Johann Schopplich
4f5000b2eb chore: release v0.9.0 2025-11-10 10:51:36 +01:00
Johann Schopplich
89b227302a fix(path-expanding): overwrite with new value 2025-11-10 10:51:12 +01:00
Johann Schopplich
eefb0242e2 feat: opt-in key folding and path expansion (closes #86) 2025-11-10 09:56:09 +01:00
Johann Schopplich
acca69c64a chore(benchmarks): replace LLM-as-judge, new structural validation 2025-11-07 21:28:21 +01:00
Johann Schopplich
853c3babea chore: fix cli entry for testing 2025-11-06 22:20:07 +01:00
Johann Schopplich
9863875706 chore: release v0.8.0 2025-11-05 19:04:20 +01:00
Johann Schopplich
840626dc90 feat: minor fixes for spec v1.4 compliance 2025-11-05 19:04:00 +01:00
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
Johann Schopplich
314497630d chore: release v0.7.3 2025-11-03 17:42:01 +01:00
Johann Schopplich
e174c46ba1 fix: add README files to published packages 2025-11-03 17:36:47 +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
8977c8c7d6 feat: use language-agnostic test suite 2025-11-02 18:31:06 +01:00
Johann Schopplich
da0a0b9be3 chore: release v0.7.0 2025-11-01 17:28:24 +01:00
Johann Schopplich
0710bd19e7 feat!: publish to @toon-format/toon and @toon-format/cli 2025-11-01 16:53:41 +01:00