terraform-provider-openapi icon indicating copy to clipboard operation
terraform-provider-openapi copied to clipboard

OpenAPI v3 support

Open thiagoarrais opened this issue 5 years ago • 6 comments

Are there any plans for supporting OpenAPI v3?

Here's what I'm getting when I do terraform plan with a v3 spec:

[DEBUG] plugin.terraform-provider-openapi_v0.22.2:
  2019/11/01 11:00:00 [ERROR] There was an error initialising the terraform provider:
  plugin terraform-provider-openapi init error while creating schema provider: swagger
  version '' not supported, specV2BackendConfiguration only supports 2.0

Checklist

Don't forget to go through the checklist to make sure the issue is created properly:

  • [x] I have added a corresponding label (feature request/bug/etc) to the issue (right side menu)
  • [x] I have added this issue to the 'API Terraform Provider' GitHub project (right side menu)

thiagoarrais avatar Nov 01 '19 14:11 thiagoarrais

P.S.: Can't actually add label nor assign projects because they're not public.

thiagoarrais avatar Nov 01 '19 14:11 thiagoarrais

Hi @thiagoarrais ,

Thanks for opening the issue. Yes, there's plans on supporting OpenAPI 3.0 and we are hoping to start working on that soon. Unfortunately, I can't really provide an actual timeline at the moment as there's other priorities in the pipe that need to be addressed first.

Nevertheless, the code is already prepared to support new OpenAPI versions implementations as shown below and I would be happy to collaborate on that if you are interested: https://github.com/dikhan/terraform-provider-openapi/blob/master/openapi/openapi_spec_analyser.go#L48.

Always happy to accept new PRs.

P.S: Thanks for letting me know about the project/labels. Will update the PR checklist accordingly and update the issue the label and project.

dikhan avatar Nov 04 '19 17:11 dikhan

Any updates on this? Trying to decide where we go from here. We're all invested in openapi 3.0 but want a dynamic provider such as this

codyaray avatar Sep 15 '21 06:09 codyaray

Hello, any updates on this? How difficult it would be to build an analyzer for V 3.0? Thank you.

davidfischer-ch avatar Nov 24 '21 15:11 davidfischer-ch

Hi folks, thanks for your feedback and your interest in the OpenAPI Terraform provider - and apologies for the slow response here (recently had a baby so my time has been pretty limited the past few months).

For the sake of more context, the main blocker for this feature request work has been the lack of support for Go libraries that serialize and deserialize OpenAPI 3.0 specs. Currently, the OpenAPI Terraform provider makes use of the go-swagger to serialize/deserialize OpenAPI 2.0 documents, unfortunately the go-swagger main contributors have stated that they won’t be supporting OpenAPIv3. Having said that, looks like there’s few alternatives in the open source community that could be used instead.

My plan is to start adding support for OpenAPI 3.0 in the upcoming year (time permitting), and the initial tentative rough roadmap includes the following:

  • Find a good supported Go library that enables loading of OpenAPI v3 documents from local and remote locations (supporting marshalling/un-marshalling of JSON/YAML documents). Bonus if it can auto expand the $refs in the document for simpler processing of the model object.
  • The OpenAPI 3.0 spec introduces major interface and behaviour changes compare to OpenAPI 2.0 that the OpenAPI Terraform provider may not be compatible for with the current design (eg: multiple servers, components, security definitions, etc). Hence, it might be worth spending some time understanding such differences and how those will be translated in the corresponding SpecAnalyser implementation.
    • As part of that, adding support to the most basic use case supported today in v2 that detects if a resource is OpenAPI Terraform compliant and if so registers it in the provider dynamically.
  • Figure out a strategy on how to maintain two tracks of work (if deemed needed) one oriented to what's currently being supported and be able to continue add improvements and bug fixes and another one focused on the v3SpecAnalyzer and corresponding changes (potentially breaking changes if needed to improve the overall plugin architecture) without coupling the releases. The Terraform SDK repo for instance uses main for the most recent supported functionality (github.com/hashicorp/terraform-plugin-sdk/v2) and a separate branch v1-maint that they continue to contribute to for the first version of the SDK (github.com/hashicorp/terraform-plugin-sdk). This is not blocking for now, but something to keep in mind once things start getting into motion.

To make it easier for the community to contribute to this endeavour, I am thinking of creating a dedicated readme with the different features needed to support the OpenAPI 3.0 version with linked stories to the OpenAPI 3.0 project. I am hoping to start putting together some initial cards early in Jan.

Hope this sheds some light into the plan to support OpenAPI 3.0 (which is something I am pretty excited about!)

And of course, any help would be more than welcomed!

Thanks, Dani

dikhan avatar Dec 24 '21 04:12 dikhan

@dikhan There has been a v3 release in April but this is not to confuse with OpenAPI v3 support of this issue, is it? I've been playing around with this project a few hours now, but I guess my issues all come down to the missing OpenAPI v3 support.

joerg avatar Nov 15 '22 13:11 joerg