hashicorp / hashicorp/terraform-plugin-codegen-openapi
Make `requestBody` for create operation optional
- Dominant language
- Go
- Stars
- 91
- Forks
- 20
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 1
Description
### Use Cases or Problem Statement
In my case a creation of the resource has only a POST method without a `requestBody`. The object is generated randomly on the server side and returned in the response body.
I can see DESIGN.md specifies clearly, that create with request body _is the only schema required for resources_.
When trying to generate the code, the resource is skipped due to above requirement - missing `requestBody`.
### Proposal
To my understanding, as long as there's a schema body in either request or response the resource mapping shall work.
The proposal is to modify `resource_mapper::generateResourceSchema` function:
1. for create request body - in case of missing schema do not return error, but set createRequestAttributes to empty list
2. for create response body - leave as it is
3. merge two sets of attributes and return error if the merged set is empty.
### Additional Information
I have a limited knowledge about the context, it's probably not seeing a big picture / all implications. It would be great if you could explain the rationale behind this requirement if it is a hard requirement.
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.