Copilot commented on code in PR #14815:
URL: https://github.com/apache/gravitino/pull/14815#discussion_r4523415470
##########
docs/open-api/functions.yaml:
##########
@@ -414,6 +414,7 @@ components:
required:
- language
- runtime
+ - handler
Review Comment:
Both `handler` and `newComment` are described as 'Cannot be null or blank',
but the schema currently only enforces non-null via `required` and `type:
string`. To actually prevent empty/whitespace-only values for clients and
validators, add constraints such as `minLength: 1` and (if needed) a pattern
that requires at least one non-whitespace character.
##########
docs/open-api/functions.yaml:
##########
@@ -427,11 +428,10 @@ components:
- TRINO
handler:
type: string
- description: The Python handler function
- nullable: true
+ description: The Python handler entrypoint. Cannot be null or blank.
codeBlock:
type: string
- description: The Python code block
+ description: The inline Python code block. Optional; it does not
replace the handler.
nullable: true
Review Comment:
Both `handler` and `newComment` are described as 'Cannot be null or blank',
but the schema currently only enforces non-null via `required` and `type:
string`. To actually prevent empty/whitespace-only values for clients and
validators, add constraints such as `minLength: 1` and (if needed) a pattern
that requires at least one non-whitespace character.
##########
docs/open-api/functions.yaml:
##########
@@ -530,15 +530,15 @@ components:
type: object
required:
- "@type"
+ - newComment
properties:
"@type":
type: string
enum:
- "updateComment"
newComment:
type: string
- description: The new comment of the function. Can be null to clear
the comment.
- nullable: true
+ description: The new comment of the function. Cannot be null or
blank.
Review Comment:
Both `handler` and `newComment` are described as 'Cannot be null or blank',
but the schema currently only enforces non-null via `required` and `type:
string`. To actually prevent empty/whitespace-only values for clients and
validators, add constraints such as `minLength: 1` and (if needed) a pattern
that requires at least one non-whitespace character.
##########
docs/open-api/functions.yaml:
##########
@@ -530,15 +530,15 @@ components:
type: object
required:
- "@type"
+ - newComment
Review Comment:
Both `handler` and `newComment` are described as 'Cannot be null or blank',
but the schema currently only enforces non-null via `required` and `type:
string`. To actually prevent empty/whitespace-only values for clients and
validators, add constraints such as `minLength: 1` and (if needed) a pattern
that requires at least one non-whitespace character.
##########
docs/manage-user-defined-function-using-gravitino.md:
##########
@@ -275,14 +276,19 @@ identifiers =
functions.list_functions(Namespace.of("public"))
### Alter a Function
-Changes are applied as a list in one request.
+Changes are applied as a list in one request. A definition is identified by
its parameter list,
+and an implementation within a definition by its runtime.
-| Change | JSON
| Java |
-|--------------------|--------------------------------------------------------------|--------------------------------------------------|
-| Rename | `{"@type":"rename","newName":"add_one_v2"}`
| `FunctionChange.rename("add_one_v2")` |
-| Update the comment | `{"@type":"updateComment","newComment":"new_comment"}`
| `FunctionChange.updateComment("new_comment")` |
-| Set a property |
`{"@type":"setProperty","property":"key1","value":"value1"}` |
`FunctionChange.setProperty("key1", "value1")` |
-| Remove a property | `{"@type":"removeProperty","property":"key1"}`
| `FunctionChange.removeProperty("key1")` |
+| Change | JSON `@type` | Other JSON fields
| Java |
+|---------------------------|--------------------|-------------------------------------------|-------------------------------------------------------------|
+| Update the comment | `updateComment` | `newComment`
| `FunctionChange.updateComment(newComment)` |
Review Comment:
In the table, the Java example uses
`FunctionChange.updateComment(newComment)` where `newComment` looks like an
undefined variable (unlike the later Java snippet that uses a string literal).
Consider changing this to a string literal (e.g.,
`FunctionChange.updateComment(\"Adds one, reviewed\")`) or explicitly
indicating that `newComment` is a placeholder parameter name to avoid reader
confusion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]