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

java.lang.Exception: cannot determine Ok result type for addPet #61

Open
kavedaa opened this issue Jan 8, 2018 · 4 comments
Open

java.lang.Exception: cannot determine Ok result type for addPet #61

kavedaa opened this issue Jan 8, 2018 · 4 comments

Comments

@kavedaa
Copy link

kavedaa commented Jan 8, 2018

When I run swaggerClientCodeGen on the YAML from the PetStore example in the online Swagger Editor:

https://editor.swagger.io

I get the following error:

[error] (*:swaggerClientCodeGen) java.lang.Exception: cannot determine Ok result
 type for addPet

Is this due to a bug in the plugin or an error in the source document?

@fralken
Copy link
Owner

fralken commented Jan 9, 2018

From the specification: "it is expected from the documentation to cover a successful operation response and any known errors"

That's why we raise an exception when a successful response is not defined.

@kavedaa
Copy link
Author

kavedaa commented Jan 9, 2018

I see, but the last paragraph in that spec section says:

"The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call."

So it depends on how to interpret "should". In my understanding "must" means "absolute requirement" and "should" means "not an absolute requirement but please do it anyway". So I don't think the presence of a success code could be depended on. And at least, as seen, the Swagger example doesn't implement it that way.

@kavedaa
Copy link
Author

kavedaa commented Jan 10, 2018

Btw, here are the standard definitions of "must" and "should": http://www.ietf.org/rfc/rfc2119.txt

@fralken
Copy link
Owner

fralken commented Jan 11, 2018

Yes, that's true. But we have to generate code from the swagger definition, so we chose to make the successful response definition mandatory, rather than provide a default implementation in case the definition is missing.

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

No branches or pull requests

2 participants