You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Remapping OAS parameter naming to attribute naming
187
+
188
+
In an OpenAPI Specification, it's possible for path or query parameters to have slightly different names then it's associated attribute in a resource/data source schema. For example, `petId` (path parameter) and `id` (defined on Pet schema):
189
+
190
+
```json
191
+
"paths": {
192
+
"/pet/{petId}": {
193
+
"get": {
194
+
"tags": [
195
+
"pet"
196
+
],
197
+
"summary": "Find pet by ID",
198
+
"description": "Returns a single pet",
199
+
"operationId": "getPetById",
200
+
"parameters": [
201
+
{
202
+
"name": "petId",
203
+
"in": "path",
204
+
"description": "ID of pet to return",
205
+
"required": true,
206
+
"schema": {
207
+
"type": "integer",
208
+
"format": "int64"
209
+
}
210
+
}
211
+
],
212
+
...
213
+
"components": {
214
+
"schemas": {
215
+
"Pet": {
216
+
"properties": {
217
+
"id": {
218
+
"type": "integer",
219
+
"format": "int64",
220
+
"example": 10
221
+
},
222
+
```
223
+
224
+
You can merge `petId` with `Pet.id` in the resulting schema by defining the following in the [generator config file](./README.md):
225
+
```yaml
226
+
resources:
227
+
pet:
228
+
# create, read, update, delete configuration
229
+
# ...
230
+
schema:
231
+
attributes:
232
+
aliases:
233
+
# Match 'petId' parameter to 'id'
234
+
petId: id
235
+
```
236
+
186
237
## Multi-type Support
187
238
188
239
Generally, [multi-types](https://cswr.github.io/JsonSchema/spec/multiple_types/) are not supported by the generator as the Terraform Plugin Framework does not support multi-types. There is one specific scenario that is supported by the generator and that is any type that is combined with the `null` type, as any Plugin Framework attribute can hold a [null](https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes#null) type.
0 commit comments