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

Cannot transform Response Objects for OpenAPIToGraphQL (Content-Type: application/vnd.kafka.v2+json) #3044

Closed
manikantasanthoshkuchimanchi opened this issue Oct 25, 2021 · 2 comments · Fixed by #4228

Comments

@manikantasanthoshkuchimanchi

Hello,

We have added an OpenAPI endpoint exposed by Strimzi Kafka Bridge for consumption of Kafka related activities.
Below is the OpenAPI mapping in the .meshrc.yaml

image

Encountering 'String cannot represent value: ' for all endpoint object responses except methods that return string.
Kindly helps us on how to deal with Content-Type: application/vnd.kafka.v2+json
Please find attached the screenshot for the error details.

image

But the endpoint is working with Postman

image

@mayan-jbsmith
Copy link
Contributor

If you inspect the following three locations, you will find content-type conditional logic being used to evaluate the schema or the submitted request body.

packages/handlers/openapi/src/openapi-to-graphql/oas_3_tools.ts:458-463
packages/handlers/openapi/src/openapi-to-graphql/oas_3_tools.ts:521-524
packages/handlers/openapi/src/openapi-to-graphql/schema_builder.ts:1110-1111

If you provide handlers for the expanded use cases e.g. application/[????]+json, noted in the description for this issue above, you could alter the generic 'application/json', and make it slightly more inclusive. This will resolve the issue and enable slightly greater utility for those custom media types that may be used in the future. These are ALL just variants that still conform to the JSON standard, and should still be parseable as JSON, therefore no additional handling should be necessary, as the JSON parser is already being used. Although currently it uses the reduced options for media-types marked with the 'content' key as defined in the schema.

We have already built and tested these changes locally, and may submit a PR soon.

You can modify the build product with patches to achieve this locally, until a PR lands, in your own dev environment.

mayan-jbsmith added a commit to mayan-jbsmith/graphql-mesh that referenced this issue Feb 27, 2022
@mayan-jbsmith
Copy link
Contributor

mayan-jbsmith commented Feb 27, 2022

The above changes may inform a path to resolve for this feature.
Please provide guidance as to anything beyond the CONTRIBUTION guidelines that would need to be considered.

ardatan added a commit that referenced this issue Aug 3, 2022
* feat: expand content type handling in openapi handler. possibly resolves for issue #3044

* Add a changeset

* Go

Co-authored-by: JB Smith <[email protected]>
@Urigo Urigo mentioned this issue Aug 11, 2022
55 tasks
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 a pull request may close this issue.

2 participants