OpenAPITools / OpenAPITools/openapi-generator
[BUG] isRestful flags are always returning false
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
When generating a new client from a valid OpenAPI 3 spec, the isRestful, isRestfulCreate, isRestfulShow, isRestfulUpdate, etc.. flags are always false in Mustache template. I have tried with several generators and seem to have the same issue with each one I tried. We need to modify the templates based on if the request is a GET, or a PUT/POST and it looks like since the templates are logicless, the only way to do that is to use the boolean isRestful flags. Please let me know if I am misunderstanding these flags or if there is a workaround to my issue.
openapi-generator version
4.3.1, 5.0.0beta1, 5.0.0beta2 all installed with npm install -g
OpenAPI declaration file content or url
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml
Steps to reproduce
Run openapi-generator generate -i https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml -g ruby --global-property=debugOperations and you will see that all endpoints/requests are set to "isRestful" : false even though they seem like they should all be true and that the POST request should be "isRestfulCreate" : true and GET should be `isRestful
Suggest a fix
I would expect all get, post, put, delete endpoints to set the isRestful flag as well as their more specific isRestfulCreate, isRestfulUpdate, etc... flag
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented openapi-generator command against the OpenAPI petstore.yaml example with --global-property=debugOperations and inspect the generated operation flags. Trace how isRestful and the method-specific flags are populated for Mustache templates; done means GET, POST, PUT, and DELETE operations report the corresponding general and specific flags correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- backend-api-design, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100