Commit Graph

27 Commits

Author SHA1 Message Date
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