fix(types): allow round-trip of export → create (closes #34)#35
Merged
Conversation
`parseSchema` now detects full DocumentType payloads (the shape returned by `types export` / `types get` since #33) and unwraps the inner `jsonSchema`. Raw JSON Schema input keeps working unchanged. This removes the need for `jq .jsonSchema` between export and create. Also add a comment around the conversionMode cast in `types create` explaining why it stays: `docutray@0.1.3` does not yet declare `conversionMode` on the DocumentType type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rarce
commented
May 7, 2026
Contributor
Author
rarce
left a comment
There was a problem hiding this comment.
Self-review
Findings
- Low: acceptance criterion in #34 asked for a follow-up issue in
docutray-nodeto addconversionModeto theDocumentTypetype. Comment in code explains the cast but the follow-up issue is not linked. Worth opening before/after merge.
Validation
- Tests: 166 passing (10 new in
test/parse-schema.test.ts), CI matrix Node 20/22 ✅ - Build:
npm run buildclean,package-verification✅ - Mergeability: MERGEABLE / CLEAN
Recommendation: Ready to merge. The round-trip heuristic is correct, raw-schema path preserved, edge cases covered (jsonSchema null / non-object / array).
3 tasks
Contributor
Author
|
Follow-up para el cast filed: docutray/docutray-node#21. Una vez mergeado allá, el cast en |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docutray-node 0.1.4 (PR #22) exposes `conversionMode` on `DocumentType` and re-exports a shared `ConversionMode` type. Replace the unknown casts in `types create` and `types update` with direct field access and the imported type alias. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Bumped This closes the last open acceptance criterion of #34 ("limpiar el cast usando acceso directo si SDK lo expone"). |
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.
Summary
parseSchemanow detects DocumentType payloads ({id, codeType, jsonSchema, ...}) and unwraps the innerjsonSchema, sotypes export→types createworks without piping throughjq. Raw JSON Schema input keeps the previous behavior.types create --helpshowing the round-trip flow.conversionModecast intypes createand added a comment explaining why it stays:docutray@0.1.3does not yet declareconversionModeonDocumentType. Worth filing a follow-up indocutray-nodeto add it; once that ships the cast can go.Closes #34.
Acceptance criteria
parseSchemadetects{jsonSchema: {...}, ...}payloads and extractsjsonSchema.jsonSchemais absent, original behavior is preserved.DocumentTypepayload (file + inline).{type: 'object', ...}) still parses unchanged.types create --helpexample shows theexport → createflow.conversionModecast documented; SDK follow-up flagged.Test plan
npm run buildnpm run test— 166 tests pass (10 new intest/parse-schema.test.ts)docutray types export <code> -o /tmp/t.json && docutray types create --name "X" --code x_copy --description "..." --schema /tmp/t.json🤖 Generated with Claude Code