-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support properties
with no type
as an object
#79
Comments
Hey there @pauly4it 👋🏻 , thanks for opening the issue. Very interesting! We hadn't really considered the use-case of an empty type being considered an
At first glance this sounds reasonable to me: if
I looked into the JSON schema spec, and while I can't find an explicit statement of |
properties
with no type
as an object
@pauly4it go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@8002d1668f3d0a95679f2bdb0089348a85d3120d |
That solved the issue. Thanks for the quick response! |
This has been merged into go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@28389a734a7050940e5541d95baca3c5ba833a4d |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
I tried using the codegen tool on our OpenAPI v3 spec with just one resource to test it out, and I got the following error:
time=2023-10-19T17:00:55.405-06:00 level=WARN msg="skipping resource schema mapping" resource=user oas_line_number=8174 err="no 'type' array or supported allOf, oneOf, anyOf constraint - attribute cannot be created"
When I dug into our schema, it looks like our spec doesn't include the
type
field for most schema objects, though they are specified in the variousproperties
values. For example:I spoke with our engineering team, and they said that in JSON Schema the type defaults to “object” and OpenAPI inherits that. For context, we're using
getkin/kin-openapi
to create the OpenAPI v3 spec.Just to checkt, I added
type
manually to the schema objects needed for the user resource, and then the tool worked without errors.Is this a requirement of the codegen tool? Or can the behavior be adjusted to assume an object type if
type
is not explicitly defined?Really appreciate the work put into this tool!
The text was updated successfully, but these errors were encountered: