hashicorp / hashicorp/terraform-plugin-codegen-openapi

Support for Any Type schema

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

Description

Our OpenAPI spec contains quite a few [Any Type](https://swagger.io/docs/specification/data-models/data-types/#any)/arbitrary-type schemas.

Currently, the codegen tool skips a resource in the generator config because one of the child schemas is an Any Type, returning the following message:
`time=2023-10-20T16:27:09.841-06:00 level=WARN msg="skipping resource schema mapping" resource=system oas_path=decision_mappings.allowed.expected oas_line_number=5019 err="no 'type' array or supported allOf, oneOf, anyOf constraint - attribute cannot be created"`

Example:
```yaml
systems.v1.AllowedMapping:
properties:
expected:
$ref: '#/components/schemas/systems.v1.AllowedMapping.expected'
negated:
default: false
description: when set to true, decision is Allowed when the mapped property IS NOT equal to the expected value
type: boolean
path:
description: dot-separated decision property path
type: string
required:
- path
systems.v1.AllowedMapping.expected: {}
```

In the above example from our spec, `expected` can by any type of value based on the user's custom configuration (e.g, `true`, `200`, `"allowed"`, `{"allowed": true, "errors": null}`, etc.).

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.