WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@hayawata3626
Copy link
Contributor

Summary

Add support for text/csv media type in the TypeScript code generator.

Problem

When OpenAPI specifications defined endpoints with text/csv responses, the findCompatibleMediaType function did not recognize this media type, resulting in undefined types in the generated TypeScript code.

@hayawata3626
Copy link
Contributor Author

@fabien0102
Hi! Could you please take a look at this PR when you have a moment?
I would really appreciate your review. Thank you!

Copy link
Owner

@fabien0102 fabien0102 left a comment

Choose a reason for hiding this comment

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

Almost perfect! Thanks for the contribution! Just a little improvement on the types and we are good to go

});

it("should return MediaTypeObject for application/json", () => {
const mediaTypeObject = { schema: { type: "object" as const } };
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
const mediaTypeObject = { schema: { type: "object" as const } };
const mediaTypeObject: MediaTypeObject = { schema: { type: "object" } };

You need to import MediaTypeObject from "openapi3-ts/oas30";

Copy link
Contributor Author

@hayawata3626 hayawata3626 Dec 8, 2025

Choose a reason for hiding this comment

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

@fabien0102
Thank you for reviewing it so quickly.
I’ve made the corrections you pointed out!

Copy link
Owner

@fabien0102 fabien0102 left a comment

Choose a reason for hiding this comment

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

Perfect!

@fabien0102 fabien0102 merged commit 536dc4d into fabien0102:main Dec 8, 2025
1 check passed
This was referenced Dec 8, 2025
@hayawata3626 hayawata3626 deleted the feat/support-text-csv branch December 9, 2025 01:42
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.

2 participants