hashicorp / hashicorp/terraform-plugin-codegen-openapi

Support readOnly and writeOnly

Open
#234 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
91
Forks
20
Avg merge
2d 13h
Merged PRs (30d)
1

Description

### Use Cases or Problem Statement

Swagger OpenAPI v3 supports `readOnly` and `writeOnly` indicators https://swagger.io/docs/specification/v3_0/data-models/data-types/#objects.
However it seems the codegen does not yet support these.

### Proposal

Handle the `readOnly` and `writeOnly` attributes in the following way:
- `readOnly` -> "computed"
- `readOnly` & `default` -> "computed"
- `readOnly` & `required` -> "computed"
- `writeOnly` -> "optional"
- `writeOnly` & `default` -> "optional"
- `writeOnly` & `required` -> "required"

### Additional Information

https://swagger.io/docs/specification/v3_0/data-models/data-types/#objects

![Image](https://github.com/user-attachments/assets/993bafea-e20e-43b4-a64e-7f14b41faa15)

### 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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.