hashicorp / hashicorp/terraform-plugin-codegen-openapi

"no compatible schema found" error. Can the tool evaluate schema $refs under the top of the path?

Open
#157 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
91
Forks
20
Avg merge
2d 13h
Merged PRs (30d)
1

Description

### tfplugingen-openapi CLI version

v0.3.0

### OpenAPI Spec File

```YAML
'/users/{user-id}':
get:
responses:
2XX:
description: Retrieved entity
content:
application/json:
schema:
$ref: '#/components/schemas/(reference path)'
```

### Generator Config

```YAML
provider:
name: (name)
data_sources:
users:
read:
path: /users/{user-id}
method: GET
```

### Expected Behavior

Evaluate the reference schema and generate the provider code spec.

### Actual Behavior

Failed with error:
```
time=(redacted) level=WARN msg="skipping data source schema mapping" data_source=users err="no compatible schema found"
```

### Additional Information

Hi team,

The OpenAPI spec for the system I am trying to create a provider for has a reference to the response object schema at the top of the schema block. Does the tool support this?
I saw on the DESIGN.md that it does support expanding a $ref tag, but it was inside of a nested schema.

Or perhaps I'm doing something wrong here?

Cheers,
Harry

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