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

[BUG][R] Endpoints returning of type Dictionary<K,V> are not properly represented in the "returnType" key in the output of generating -DdebugOperations #2201

Closed
4 of 6 tasks
Ramanth opened this issue Feb 20, 2019 · 2 comments

Comments

@Ramanth
Copy link
Contributor

Ramanth commented Feb 20, 2019

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)

This is an issue with R language generator.

Description

i have an endpoint for which the return type is a dictionary, say Dictonary(string, Object1)
but when the client is generated using openapi-generator-3.3.4.jar the response is just creating an object of type say Object1 instead of a Dictionary equivalent.

I compared the returnType of endpoint in the generated json using the -DdebugOperations with python against that with R
for Python, it has "returnType" : "dict(str, Object1)
for R, it is "returnType" : "Object1"

so the openapi-generator is not generating the returnType key as an equivalent of dictionary for R langauge.

openapi-generator version

3.3.4

OpenAPI declaration file content or url

R generated structure :
using "java -DdebugOperations -jar openapi-generator-cli-3.3.4.jar generate -l r ......."

       "isRestful" : false,
      "isDeprecated" : false,
      "isCallbackRequest" : false,
      "path" : "/axxx/px/v1/caxxxxxx",
      "operationId" : "get_all_xxxxxx",
      **"returnType" : "Oxxxxxxon",**     //difference in this line with respect to below json
      "httpMethod" : "GET",
      "returnBaseType" : "Oxxxxxon",
      "returnContainer" : "map",
      "summary" : "Get All Oxxxxons",

Python generated structure:
using "java -DdebugOperations -jar openapi-generator-cli-3.3.4.jar generate -l python ......."

      "isRestful" : false,
      "isDeprecated" : false,
      "path" : "/axxx/px/v1/caxxxxxx",
       "operationId" : "get_all_xxxxxx",
      "returnType" : "dict(str, Oxxxxxxon)",    
      "httpMethod" : "GET",
      "returnBaseType" : "Oxxxxxon",
      "returnContainer" : "map",
      "summary" : "Get All Oxxxxons",

From the above the R generation is ignoring the Dictionary and simply returning the bare Object type.
This is causing issue in deserialization in the generated model file.
-->

Command line used for generation

java -DdebugOperations -jar openapi-generator-cli-3.3.4.jar generate -l r

Steps to reproduce

As describe above

Related issues/PRs

NA

@wing328 - looking for your help. Thanks in advance.

@auto-labeler
Copy link

auto-labeler bot commented Feb 20, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@spacether
Copy link
Contributor

spacether commented Jan 12, 2022

Going forward for 3.X.X specs, returnType is not the best property to use for this info because responses can include:

  • bodies that can very depending upon the content type
  • headers

To fully use those features, please use the CodegenResponse.responseHeaders and CodegenResponse.content
which contain the response headers and content defined in the openapi spec: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responseObject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants