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

get specific result node on json #3206

Open
Ziaccro opened this issue Jun 23, 2016 · 4 comments
Open

get specific result node on json #3206

Ziaccro opened this issue Jun 23, 2016 · 4 comments

Comments

@Ziaccro
Copy link

Ziaccro commented Jun 23, 2016

Description

Hello,
i want to know if there is a option to set a specif node to get the result of the json ?

All endpoint of our api return same schema response ApiResult[T],
for exemple when i get user with findById, on the node result i get the User ApiResult[User]

{
  "error": {
  },
  "result": { 
      "email": "",
       ...
  },
  "debug": {
  },
  "meta": {
  }
}

the user is on node result

the problem is, on swagger spec we define as return the model User, on error we describes Error ect ...

in the spec swagger we can't template this and its not a good idea of write model ApiResultUser, ApiResultAddress, ApiResultEnterprise, ... the number of class is huge

i hope there is a workaround, a way to change the method ApiInvoked.deserialize ?

otherwise the code generate is not usable, that fail on the validation of json

@wing328
Copy link
Contributor

wing328 commented Jun 24, 2016

As a workaround, you can describe result as type: object, which means arbitrary JSON object and the developers will need to deserialize the object themselves.

@Ziaccro
Copy link
Author

Ziaccro commented Jun 24, 2016

you mean all the json return as object or just the node result ?

with this solution I lose clarity on documentation and its unfortunate to force the user to reparse json

I will try to modify the swagger-codegen and add "general scheme" on it

can you give me some file name from what started reading the code please ?

@wing328
Copy link
Contributor

wing328 commented Jun 24, 2016

Just the node result.

Can you share the full spec?

@Ziaccro
Copy link
Author

Ziaccro commented Jun 24, 2016

yes sure its here https://test-api.particeep.com/docs/swagger.json

@wing328 wing328 added this to the v2.2.2 milestone Oct 2, 2016
@wing328 wing328 modified the milestones: Future, v2.2.2 Feb 16, 2017
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