PiotrAndrzejewsky commented on PR #14637:
URL: https://github.com/apache/gravitino/pull/14637#issuecomment-6683222937
While testing the documentation examples against a live Gravitino server, I
noticed that the REST example under Create a View was also failing request
validation.
### Root Cause:
In ViewCreateRequest.java#L116-L117 the server validates:
```
Preconditions.checkArgument(
representations != null && representations.length > 0,
"\"representations\" field is required and cannot be empty");
```
The previous curl snippet passed "query": "..." and "dialect": "..."
directly at the root JSON level, which was ignored by Jackson
deserialization and triggered 400 Bad Request: "representations" field is
required and cannot be empty.
### Fix:
Updated the REST example payload to use the proper array structure:
```
"representations": [
{
"type": "sql",
"sql": "SELECT * FROM customers WHERE last_order_at > current_date -
interval 365 day",
"dialect": "spark"
}
],
"properties": {
"spark.sql.create.version": "3.5.0"
}
```
Verified live that this request now succeeds with HTTP 200 OK.
I also verified every example there is in documentation and everything now
looks good.
--
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]