feat(bfabric_scripts): JSON input for the api commands - #617
Draft
leoschwarz wants to merge 2 commits into
Draft
Conversation
Closes #159. api read, create and update accept --json and --json-file, which is the only way to pass a nested or non-string attribute value. Both live on Query, so all three commands get them without per-command code; cyclopts treats a field-level Parameter(name="--json") as an absolute name, so they surface as plain --json rather than --query.json. The JSON object is merged over the key-value pairs and a key given in both is rejected, rather than silently letting one win. Two fixes fell out of this: - validate_query's dict branch returned {"pairs": ...}, dropping every other key, so the new fields vanished whenever positional pairs were also given. - create's _must_not_contain_id iterated the model rather than the attributes, so it yielded field names and never once caught an id attribute. Both the pairs and the JSON path are checked now.
# Conflicts: # bfabric_scripts/docs/changelog.md
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.
--jsonand--json-filetoapi read,api createandapi update— the only way to pass a nested or non-string attribute value.api createrejecting anidattribute; the check never fired before.Stacked on #616 — review that one first, and expect this diff to shrink once it merges.
Closes #159
🤖 Prepared with assistance from Claude Opus 5 via Claude Code.