Skip to content

Support patterned and default HTTP status codes #1303

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dbanty
Copy link
Collaborator

@dbanty dbanty commented Aug 19, 2025

Closes #1271 and #832

@dbanty dbanty force-pushed the support-patterned-status-codes-1271 branch from 6cf48dd to 888d881 Compare August 19, 2025 02:37
@dbanty dbanty force-pushed the support-patterned-status-codes-1271 branch from 2f8bf10 to 3df0ba6 Compare August 24, 2025 01:51
@dbanty dbanty changed the title feat: Support simple patterned http status codes Support patterned and default HTTP status codes Aug 24, 2025
@dbanty dbanty force-pushed the support-patterned-status-codes-1271 branch from 3df0ba6 to 05367ca Compare August 24, 2025 03:11
@dbanty dbanty force-pushed the support-patterned-status-codes-1271 branch 2 times, most recently from 46d5210 to d70d32c Compare August 24, 2025 03:17
Co-Authored-By: Jonathan Goodson <[email protected]>
Co-Authored-By: Peter Kolloch <[email protected]>
@dbanty dbanty force-pushed the support-patterned-status-codes-1271 branch from d70d32c to 201973b Compare August 24, 2025 03:19
@dbanty dbanty requested a review from Copilot August 24, 2025 03:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for patterned and default HTTP status codes in OpenAPI specifications, enabling the use of status code patterns like 2XX, 4XX, and default in addition to specific status codes like 200.

  • Introduces new HTTPStatusPattern class to handle parsing and validation of status code patterns
  • Refactors response handling to support both specific codes and ranges with proper precedence ordering
  • Updates template generation to handle default responses and status code ranges in generated client code

Reviewed Changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openapi_python_client/parser/responses.py Adds HTTPStatusPattern class and Responses container with pattern/default separation
openapi_python_client/parser/openapi.py Updates Endpoint class to use new response structure and pattern parsing
openapi_python_client/templates/endpoint_module.py.jinja Modifies template to generate range checks and handle default responses
tests/test_parser/test_responses.py Updates tests to use HTTPStatusPattern instead of HTTPStatus
end_to_end_tests/ Adds new test endpoints and updates generated client files for pattern support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dbanty
Copy link
Collaborator Author

dbanty commented Aug 24, 2025

Just gotta add tests for coverage

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Patterned (4XX) HTTP Status Codes not respected
2 participants