aws / aws/aws-pdk

[FEATURE] (type-safe-api) Better code generation for "default" responses in OpenAPI

Open
#847 1 comment 0 reactions 0 assignees View on GitHub
backlog feature-request needs-triage
Dominant language
TypeScript
Stars
451
Forks
84
Avg merge
20h 3m
Merged PRs (30d)
1

Description

### Describe the feature

OpenAPI lets you define a [default response](https://swagger.io/docs/specification/v3_0/describing-responses/#default-response).

Currently code generation treats this as a `0` response code, however we should generate code which conforms better to the specification.

### Use Case

More intuitive behaviour for a given OpenAPI spec.

### Proposed Solution

* Handler wrappers should allow returning any response code (ideally other than other defined responses) with alongside the modelled response.
* Clients/hooks should deserialise responses to the appropriate modelled response for any default responses with 2XX codes. Possibly combine with #821 to deserialise error responses too.

### Other Information

_No response_

### Acknowledgements

- [X] I may be able to implement this feature request
- [X] This feature might incur a breaking change

### PDK version used

0.23.60

### What languages will this feature affect?

Typescript, Java, Python

### Environment details (OS name and version, etc.)

OSX

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests, so start by locating the type-safe-api generator's handling of OpenAPI default responses across the TypeScript, Java, and Python outputs. Review the current `0` response-code behavior and related issue #821 before defining compatible handler and client/hook behavior. Done means default responses follow the OpenAPI specification without incorrectly treating them as status code 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, python, typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.