fix: [IOCOM-2842] Add support for body in patch call#333
Merged
Conversation
Jira Pull Request LinkThis Pull Request refers to the following Jira issue IOCOM-2842 |
There was a problem hiding this comment.
Pull request overview
This PR adds support for request body and Content-Type header handling in PATCH HTTP method operations for OpenAPI v3 specifications. Previously, PATCH was recognized as a supported method but lacked the necessary logic to handle request bodies and set appropriate Content-Type headers.
Key Changes
- Added "patch" to the
SupportedMethodtype definition alongside existing methods - Updated OpenAPI v3 parser to include "patch" in body parameter and Content-Type header logic
- Added test cases and mock API endpoints for PATCH operations with request bodies
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/commands/gen-api-models/types.ts | Added "patch" to SupportedMethod type union in alphabetical order |
| src/commands/gen-api-models/parse.v3.ts | Extended body parameter parsing and Content-Type header logic to include "patch" method |
| src/commands/gen-api-models/tests/parse.test.ts | Added unit test for parsing PATCH operations with body references |
| src/commands/gen-api-models/tests/snapshots/index.test.ts.snap | Updated snapshots with generated client code for PATCH operations |
| mocks/openapi_v3/api.yaml | Added test endpoint /patch-test-parameter-with-body-ref for OpenAPI v3 spec |
| mocks/api.yaml | Added test endpoint /patch-test-parameter-with-body-ref for OpenAPI v2 spec |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
patchcall support was added without support forbody(#280)Motivation and Context
This PR adds support for
bodyandcontent-typeheader when generating apatchcallHow Has This Been Tested?
Unit tests
Screenshots (if appropriate):
Types of changes
Checklist: