Andrea Cosentino created CAMEL-28043:
----------------------------------------

             Summary: camel-google-text-to-speech: no per-message headers, SSML 
unreachable, and the component options are not exposed
                 Key: CAMEL-28043
                 URL: https://issues.apache.org/jira/browse/CAMEL-28043
             Project: Camel
          Issue Type: Bug
          Components: camel-google
            Reporter: Andrea Cosentino


Found during an audit of the cloud components (camel-aws, camel-azure, 
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was 
verified against the source.

h4. 1. The component options are not exposed
{{GoogleCloudTextToSpeechComponent}} annotates its {{configuration}} field with 
{{@Metadata}} but has a getter and no setter, so the generated catalog lists 
only {{lazyStartProducer}} and {{autowiredEnabled}} as component properties. 
{{camel.component.google-text-to-speech.serviceAccountKey}} and friends cannot 
be set from properties or from Spring Boot at all. Five of the camel-google 
components share this shape: bigquery, functions, speech-to-text, 
text-to-speech and vision. CAMEL-27673 already tracks it for speech-to-text; 
this is the text-to-speech half, verified independently.
Proposed change: add {{setConfiguration}}.

h4. 2. No per-message headers for voice, language, encoding, rate or pitch
{{GoogleCloudTextToSpeechConstants}} has exactly two headers, operation and the 
response object, and the producer builds {{VoiceSelectionParams}} and 
{{AudioConfig}} from the configuration only. Varying the voice or the language 
per message needs one endpoint per voice, or pojoRequest=true, which then 
discards every option.

h4. 3. SSML input is unreachable without pojoRequest
The producer always calls {{SynthesisInput.newBuilder().setText(text)}}. The 
bundled SDK (google-cloud-texttospeech 2.104.0) supports ssml and markup on the 
same message. SSML is the normal way to control pauses and emphasis, so users 
must fall back to pojoRequest and rebuild the voice and audio config by hand.

h4. 4. operation and audioEncoding are validated at the first message
{{createEndpoint}} only rejects a blank path, so 
{{google-text-to-speech:synthesise}} (a typo) or {{?audioEncoding=mp3}} starts 
fine and then fails every exchange with a raw "No enum constant". A null 
audioEncoding set programmatically gives an NPE inside valueOf.
Proposed change: validate in createEndpoint / doInit.

h4. 5. Smaller issues
{{operation}} and {{audioEncoding}} are Strings with no {{enums =}} on the 
{{@UriParam}}, although both have a backing enum, so tooling offers no 
completion; the legal encodings are only in prose.
Long-audio and streaming synthesis are unsupported, although 
{{TextToSpeechClient.streamingSynthesizeCallable()}} and 
{{TextToSpeechLongAudioSynthesizeClient}} exist. synthesizeSpeech caps at about 
5000 bytes, so a document cannot be synthesized and an over-long body is 
forwarded to a failing call.
{{TextToSpeechClient}} is a gax BackgroundResource: {{close()}} only starts the 
shutdown, and the endpoint closes it after {{super.doStop()}} and without 
{{awaitTermination}}.
The non-pojo synthesize test asserts only languageCode, so a wrong-setter 
copy-paste in voiceName, audioEncoding, speakingRate or pitch would not be 
caught.
{{google-text-to-speech-component.adoc}} has an explicit 
{{[[GoogleTextToSpeech-AuthenticationConfiguration]]}} anchor before a heading, 
which the project's conventions forbid because it replaces the auto-generated 
id.

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to