Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamline performSpeechRequest #172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kalafus
Copy link
Contributor

@kalafus kalafus commented Feb 14, 2024

What

remove special handling of performSpeechRequest

handle receiving raw (non-JSON-wrapped) data in the same workflow as all other incoming data.

Why

AudioSpeechResult wrapper uniquely does not represent JSON wrapped Data, but the endpoint rather returns raw Data.

Since it's not JSON encoded, there's no way to use JSONDecoder and init(Decoder:) to correctly handle the returned data, but exceptional handling can be added for Data return type to skip JSONDecoder and return the raw Data object. Exception first attempts to decode using builtin Data type JSONDecoder, and only returns raw data when Data type is specified, and JSONDecode as Data type has failed, so this is a pretty reusable approach.

Affected Areas

performSpeechRequest

@kalafus kalafus changed the title remove special handling performSpeechRequest streamline performSpeechRequest Feb 15, 2024
Copy link

sonarcloud bot commented Feb 16, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
1.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant