Allow functions configure to set --response-format - #95
Merged
Conversation
Extend the flag generator so JSON-document fields work on application/json bodies, regenerate from staging, and wire configure's help and empty-patch guard to the new flag. Co-authored-by: Cursor <cursoragent@cursor.com>
|
| Filename | Overview |
|---|---|
| scripts/gen-flags/codegen.go | Adds JSON-document mapping for application/json bodies, but decoding into interface values can silently round large numbers. |
| internal/cmd/functionconfigure_flags.gen.go | Registers and builds the new response-format field using the generator’s lossy numeric conversion path. |
| internal/cmd/functions.go | Integrates response-format into configure validation and help while preserving the existing request lifecycle. |
| internal/api/client.gen.go | Adds the generated optional response_format object to the metadata update contract. |
| internal/cmd/functionsextra_test.go | Verifies response-format can be sent alone and unrelated metadata remains omitted, but uses no precision-sensitive numeric values. |
| scripts/gen-flags/parser_test.go | Covers generation of a JSON-document field in an application/json body. |
| README.md | Documents configuring the return schema without re-uploading function code. |
Prompt To Fix All With AI
### Issue 1
scripts/gen-flags/codegen.go:380
**Large numbers lose precision**
Unmarshalling the schema into `map[string]interface{}` converts JSON numbers to `float64`. A valid schema containing an integer beyond exact float64 precision, such as `{"const":9007199254740993}`, is rounded when the generated client marshals the PATCH body. The service then stores a response schema different from the one the user supplied. Please preserve numeric tokens with `json.Number` or another lossless JSON representation.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "Allow functions configure to set --respo..." | Re-trigger Greptile
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
notte functions configure --response-formatcan documentrun()'s return schema without re-uploading code@file/ stdin), matching create/updateTest plan
go test ./scripts/gen-flags/ ./internal/cmd/ -run 'JSONBody|FunctionConfigure|Multipart|JSONDocument'make checknotte functions configure --response-format @schema.jsonagainst a real function; confirm PATCH body sends an object and other metadata is unchangednotte functions configurewith no flags still errors with the updated "nothing to configure" messageMade with Cursor