Skip to content

v0.1.8

Compare
Choose a tag to compare
@dikhan dikhan released this 28 Aug 17:48
· 2142 commits to master since this release

Summary of changes

  • Added support for support for x-terraform-field-name which enables service providers to override property names with different names.
  • Automatic conversion of openapi field names to terraform compliant names. This applies to:

securityDefinition names

securityDefinitions:
  apikeyAuth: # this is not terraform name compliant; hence it will be converted to apikey_auth. This will be the name used in the terraform provider config file.
    type: "apiKey"
    name: "Authorization"
    in: "header"

Corresponding terraform configuration view:

provider "swaggercodegen" {
  apikey_auth = "${var.apikey_auth}"
}

header param names

paths:
  /v1/cdns:
    post:
      parameters:
      - in: "header"
        name: "X-Request-ID" # this is not a terraform compliant name; hence it will be converted to x_request_id. This will be the name used in the terraform provider config file.
        type: "string"
        required: true

Corresponding terraform configuration view:

provider "swaggercodegen" {
  x_request_id = "request header value for POST /v1/cdns"
}

definition property names

definitions:
  ContentDeliveryNetworkV1:
      exampleInt: # this name is not terraform name compliant; the provider will do a translation on the fly to make it terraform name compliant - the result will be example_int
        type: integer
      exampleNumber:
        type: number
        x-terraform-field-name: betterExampleNumberName  # this enables service providers to override the property name with a different name; and if the name is again not terraform compliant the same conversion will be applied on the value - the result will be better_example_number_name

Corresponding terraform configuration view:

resource "swaggercodegen_cdns_v1" "my_cdn" {
  example_int = 12
  better_example_number_name = 1.12
}

Changelog

2595658 addressing PR comments
7d763ee update documentation with new extension (x-terraform-field-name) support
ae0dc74 loosen up constraints about expected status codes
5fdc54f get latest version of http client
6355df4 fix test after adding auto field terraform name conversions
8816dca quick rename to be consistent when referring to resourceLocalData
f593517 create isIDProperty to reduce boiler plate
ba1e30e wrap state operations in methods that handle name conversion
8d33cba convert to terraform compliant name when saving payload data into state and reading from it
24c489d refactor swaggercodegen example to handle better model object
38f9260 convert to terraform compliant name when getting payload from data
c851659 automatically convert security schemes names that are not terraform name compliant
8c6eb18 add support for extension x-terraform-field-name
9b939b0 dep add github.com/iancoleman/strcase
482b893 fix versions