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

Conform RuntimeError to HTTPResponseConvertible #135

Merged
merged 7 commits into from
Dec 20, 2024

Conversation

gayathrisairam
Copy link
Contributor

Motivation

apple/swift-openapi-generator#609 (comment)

Modifications

Confirm RuntimeError to HTTPResponseConvertible and provide granular status codes.

Result

Response codes for bad user input will be 4xx (instead of 500)

Test Plan

Unit tests.

@simonjbeaumont simonjbeaumont changed the title Confirm RuntimeErrors to HTTPResponseConvertible Conform RuntimeErrors to HTTPResponseConvertible Dec 18, 2024
Copy link
Collaborator

@simonjbeaumont simonjbeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gayathrisairam! Added some comments.

Sources/OpenAPIRuntime/Errors/RuntimeError.swift Outdated Show resolved Hide resolved
Sources/OpenAPIRuntime/Errors/RuntimeError.swift Outdated Show resolved Hide resolved
Sources/OpenAPIRuntime/Errors/RuntimeError.swift Outdated Show resolved Hide resolved
Sources/OpenAPIRuntime/Errors/RuntimeError.swift Outdated Show resolved Hide resolved
Tests/OpenAPIRuntimeTests/Errors/Test_RuntimeError.swift Outdated Show resolved Hide resolved
Tests/OpenAPIRuntimeTests/Errors/Test_RuntimeError.swift Outdated Show resolved Hide resolved
@simonjbeaumont simonjbeaumont added the 🆕 semver/minor Adds new public API. label Dec 19, 2024
Copy link
Collaborator

@simonjbeaumont simonjbeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM now. There's just a couple of typos though, then it's good to land.

Sources/OpenAPIRuntime/Errors/RuntimeError.swift Outdated Show resolved Hide resolved
Tests/OpenAPIRuntimeTests/Errors/Test_RuntimeError.swift Outdated Show resolved Hide resolved
Tests/OpenAPIRuntimeTests/Errors/Test_RuntimeError.swift Outdated Show resolved Hide resolved
Copy link
Collaborator

@simonjbeaumont simonjbeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work—thanks @gayathrisairam!

@simonjbeaumont simonjbeaumont changed the title Conform RuntimeErrors to HTTPResponseConvertible Conform RuntimeError to HTTPResponseConvertible Dec 20, 2024
@simonjbeaumont simonjbeaumont merged commit 7e80669 into apple:main Dec 20, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants