fix(core): csv delimiter, api security, serializers, and visibility#81
Open
pixincreate wants to merge 10 commits into
Open
fix(core): csv delimiter, api security, serializers, and visibility#81pixincreate wants to merge 10 commits into
pixincreate wants to merge 10 commits into
Conversation
- Fix CSV output ignoring custom delimiter (serialize_csv, escape_csv) - Add 10MB request body limit to HTTP API (DoS prevention) - Fix JSON escape_string missing control chars per RFC 8259 - Fix serialize_toml not escaping keys with special chars - Fix format_datetime masking errors with hardcoded fallback dates - Fix API csv_delimiter validation to return error on invalid input - Fix Object::remove to use shift_remove (preserve insertion order) - Fix Array::remove to return Option and bounds check
- API: Unified error responses with proper HTTP status codes (200/400/422) - API: Consistent ApiResult<T> type for both parse and convert endpoints - XML: Empty elements now serialize as Null instead of empty Object - XML: Fix round-trip instability by using single-key Object as root name - TOML: Refactor .get().cloned() anti-pattern in 4 functions (no more Value cloning) - XML: Single-pass escape_xml implementation (1 allocation vs 5)
- Add nested [table] section support to serialize_toml (proper TOML output) - Create modular zparse-api structure (types, handlers, router modules) - Add 12 API integration tests using axum::test - Add 13 CLI integration tests using assert_cmd - Fix test expectations to match actual CLI behavior - All tests passing: 156 unit + 12 API + 13 CLI + 1 doctest
- Make JsonParser::config(), depth(), bytes_parsed() #[cfg(test)] - Add with_max_depth() and with_max_size() builder methods to Config - Make Cursor pub(crate) with all methods internal - Move Cursor tests from tests/ to inline #[cfg(test)] module - Remove external lexer_cursor_tests.rs - Make Cursor::consume #[cfg(test)] (only used in tests) - All 177 tests pass, clippy clean, build clean
pixincreate
added a commit
that referenced
this pull request
Mar 15, 2026
- Make CORS configurable via ZPARSE_CORS_ORIGIN env var - * = allow any origin (dev mode) - specific value = allow that origin - unset = restrictive (no CORS headers) - Simplify main.rs to use modular structure (lib/handlers/router) - Remove datetime fallbacks in serialize_json and value_to_children - Now returns null or empty instead of hardcoded 1979 date - All 181 tests pass, clippy clean, fmt clean
- Make CORS configurable via ZPARSE_CORS_ORIGIN env var - * = allow any origin (dev mode) - specific value = allow that origin - unset = restrictive (no CORS headers) - Simplify main.rs to use modular structure (lib/handlers/router) - Remove datetime fallbacks in serialize_json and value_to_children - Now returns null or empty instead of hardcoded 1979 date - All 181 tests pass, clippy clean, fmt clean
9259637 to
aba3d3e
Compare
…sion - Parse endpoint now uses native zparse parsers directly: - JsonParser for JSON/JSONC - CsvParser for CSV - from_toml_str for TOML - from_yaml_str for YAML - zparse::convert for XML (XmlDocument handling) - Remove serde_json::from_str double conversion - Only use serde_json for final HTTP response serialization - All 181 tests pass
- Remove serde_json from production dependencies - Add native JsonResponse and JsonError types in new json.rs module - Export json module from lib.rs
- Use AxumJson for request parsing - Use custom JsonResponse/JsonError for responses - Remove ApiResponse type alias from router
- Move serde_json to dev-dependencies for test usage
aba3d3e to
c4e58a2
Compare
- Add to_json_string, to_toml_string, to_yaml_string, to_csv_string to convert.rs - Export serializers in lib.rs for public use - Update API to use zparse serializers instead of custom implementation
2dbda38 to
217f4df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
P0 Bug Fixes
serialize_csv()andescape_csv()now use the configured delimiter fromConvertOptionsinstead of hardcoded commaDefaultBodyLimit::max()\b,\f, and\uXXXXescapes per RFC 8259unwrap_or_elsewith hardcoded dates to properResultpropagationP1 Fixes
Nullinstead of emptyObjectP2 Improvements
.get().cloned()anti-pattern in 4 functions, eliminating unnecessary Value clones[table]sections for nested objects instead of inline tables onlyCode Quality
Cursorispub(crate),JsonParserinternal methods are#[cfg(test)]with_max_depth(),with_max_size()on JSON/TOML Config typestypes.rs,handlers.rs,router.rsmodulesContext
This PR addresses all P0 bugs and medium-priority issues identified in comprehensive code review. The changes improve correctness (CSV delimiter actually works), security (API body limits), and maintainability (proper encapsulation).
Related to code review findings:
pubsolely for testingHow did you test it?
assert_cmdaxum::testManual verification:
Checklist