Skip to content

Fix missing request type #1051

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

Merged
merged 2 commits into from
Mar 24, 2025
Merged

Fix missing request type #1051

merged 2 commits into from
Mar 24, 2025

Conversation

yepninja
Copy link
Contributor

The Problem

Conditions:

  • Using Swagger v2.
  • There are two or more paths with the same parameters, where the parameters are reference objects.

Current behaviour:

  • When converting Swagger v2 to OpenAPI v3 using swagger2openapi, references in requestBody are not resolved.
  • As a result, requestBody appears as:
{ '$ref': '#/components/requestBodies/Pet' }
  • getRequestBodyInfo -> getContentTypes doesn't return correct type
  • The method is missing the expected type.

Expecting:

  • swagger2openapi should correctly resolve references.
  • The requestBody should be transformed into:
{
  content: { 'application/json': { schema: ... } },
}
  • getRequestBodyInfo -> getContentTypes should return the correct content type.
  • The method should have the correct type.

Copy link

changeset-bot bot commented Feb 12, 2025

🦋 Changeset detected

Latest commit: 1fe8e24

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
swagger-typescript-api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@smorimoto smorimoto added bug Something isn't working enhancement New feature or request labels Mar 24, 2025
Signed-off-by: Sora Morimoto <[email protected]>
@smorimoto smorimoto merged commit 0797349 into acacode:main Mar 24, 2025
1 check passed
@github-actions github-actions bot mentioned this pull request Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants