oscerd opened a new pull request, #28959:
URL: https://github.com/apache/camel/pull/28959

   Fixes [CAMEL-26243](https://issues.apache.org/jira/browse/CAMEL-26243), 
found while adding the catalog body types (CAMEL-24961).
   
   ## 1. spreadsheets/developerMetadata, spreadsheets/sheets and 
spreadsheets/values failed with a ClassCastException
   
   **Was:** the generator listed every public method of `Sheets.Spreadsheets`, 
including the accessors `developerMetadata()`, `sheets()` and `values()`, which 
return a sub-resource and not a request. The three were in the catalog as 
methods of the spreadsheets API, the endpoint was created, and the producer and 
the consumer failed on the first call with `ClassCastException: ... cannot be 
cast to AbstractGoogleClientRequest`.
   
   **Now:** the spreadsheets API of the module `pom.xml` excludes the three 
accessors 
(`<excludeMethods>\s(developerMetadata|sheets|values)\(\)$</excludeMethods>`, 
the option camel-box, camel-as2 and camel-braintree use), so 
`SheetsSpreadsheetsApiMethod` no longer has them and the catalog no longer 
lists them. An endpoint such as `google-sheets:spreadsheets/values` now fails 
when it is created with `No matching method for spreadsheets/values`, for the 
producer and the consumer. The methods of the values are the `data` API, as 
before; the component doc now says so.
   
   ## 2. The splitResult option has no effect
   
   **Was:** `splitResult` (consumer, default `true` since CAMEL-26025) is 
documented as "one exchange per element" of an array or collection result. No 
google-sheets method returns one: `Spreadsheet`, `ValueRange`, 
`BatchGetValuesResponse` and the others are single model objects, so the 
consumer always sends one message per poll.
   
   **Now:** documented, not changed: the component doc says that the option has 
no effect on google-sheets and points to google-sheets-stream with 
`splitResults=true` for one message per row, and the `consumerOut` body type 
says the same. The option is kept, as it comes from `AbstractApiConfiguration` 
in camel-support and hiding it would change the shared configuration class.
   
   ## Tests
   
   - New `GoogleSheetsApiMethodsTest` (5 tests): every method of every API 
builds an `AbstractGoogleClientRequest`; `spreadsheets/developerMetadata`, 
`spreadsheets/sheets` and `spreadsheets/values` are rejected when the endpoint 
is created (parameterized); `data/get` reads a `ValueRange` through a fake 
`MockHttpTransport` client set with the client factory.
   - New test in `GoogleSheetsConsumerSplitResultTest`: a `data/get` consumer 
with the default `splitResult=true` sends one message with all three rows of 
the `ValueRange`.
   - With the fix reverted (the `pom.xml`, `src/main` and `src/generated` 
changes), 4 of the 6 new tests fail on assertions: the three accessors are 
listed as methods that build no request, and the three endpoints are created. 
The 2 that pass are `data/get`, which checks the way that already worked, and 
the split result test, which pins the behaviour that item 2 documents.
   - Module tests: 49 run, 0 failures.
   
   ## Docs and generated files
   
   - Component doc: the `data` API for the values, and the consumer with 
`splitResult`. The `consumerOut` body type says that `splitResult` has no 
effect.
   - Regenerated `SheetsSpreadsheetsApiMethod`, 
`SheetsSpreadsheetsEndpointConfiguration` and `google-sheets.json` (the 
spreadsheets API without the three accessors, the body type), copied into the 
catalog with the doc.
   - No endpoint option or header changes, so the endpoint DSL does not change.
   - No upgrade guide entry: the three methods never worked, and `splitResult` 
behaves as before.
   
   ## Not changed
   
   - The hand-written `methodName` enum of `GoogleSheetsConfiguration` 
(`create,get,update,append,batchUpdate,clear`) does not list the accessors, so 
it needs no change for this issue. It lacks 6 method names (`batchClear`, 
`batchClearByDataFilter`, `batchGet`, `batchGetByDataFilter`, 
`batchUpdateByDataFilter` and `getByDataFilter`), so the catalog validation of 
an endpoint such as `data/batchGet` reports an invalid enum value. **Open 
question:** fix it here, as CAMEL-26242 and CAMEL-26244 do for google-mail and 
google-drive, or in a follow-up?
   - The fix is in the module configuration, not in 
camel-api-component-maven-plugin: only google-mail and google-sheets list such 
accessors.
   
   Main only, as the other fixes of the CAMEL-24961 follow-ups.
   
   _Claude Code on behalf of Andrea Cosentino (oscerd)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to