apple / apple/swift-openapi-generator

Handle encoding and decoding errors in a middleware-like extension point

Open
#522 15 comments 0 reactions 0 assignees View on GitHub
area/runtime kind/enhancement
Dominant language
Swift
Stars
2k
Forks
182
Avg merge
13h 28m
Merged PRs (30d)
5

Description

### Question

I'd like to add telemetry to my app to report issues where an API response is missing a required key or otherwise has decoding errors. Ideally I could write middleware to achieve this, but from what I've been able to tell, middleware can't intercept decoding errors.

In a perfect world, the server handling the API requests would always return 100% spec-compliant responses, never introducing breaking changes, but mistakes happen.

How would you suggest I add this telemetry to my client application using `swift-openapi-*`?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the generated client decoding path and the middleware-like extension points in the swift-openapi-* packages. Determine where missing required keys and other decoding errors can be observed, then define an extension mechanism that lets applications report this telemetry without changing generated API behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, swift
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.