Skip to content
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

[FeatureRequest: Issue #305] Support colon characters in field names #306

Merged
merged 5 commits into from
Jul 22, 2021

Conversation

bradthebuilder
Copy link
Contributor

@bradthebuilder bradthebuilder commented Jun 25, 2021

What problem does this Pull Request solve?

Please link to the issue number here (issue will be closed when PR is merged): Closes #305

Type of change

What type of change does your code introduce to the provider? Please put an x (w/o heading/trailing white spaces) in the boxes that apply:

  • New feature (change that adds new functionality)
  • Bug-fix (change that fixes current functionality)
  • Tech debt (enhances the current functionality)
  • New release (pumps the version)

Checklist

Please put an x (w/o heading/trailing white spaces) in the boxes that apply:

  • I have read and followed the CONTRIBUTING guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have made sure code compiles correctly and all tests are passing by running make test-all
  • I have added/updated necessary documentation (if appropriate)
  • I have added the following info to the title of the PR (pick the appropriate option for the type of change). This is important because the release notes will include this information.
    • Feature Request: PRs related to feature requests should have in the title [FeatureRequest: Issue #X] <PR Title>
    • Bug Fixes: PRs related to bug fixes should have in the title [BugFix: Issue #X] <PR Title>
    • Tech Debt: PRs related to technical debt should have in the title [TechDebt: Issue #X] <PR Title>
    • New Release: PRs related to a new release should have in the title [NewRelease] vX.Y.Z

Checklist for Admins

  • Label is populated
  • PR is assigned to the corresponding project
  • PR has at least 1 reviewer and 1 assignee

Commentary

All unit tests pass on my system.

The following integration tests in tests/integration/resource_monitors_test.go failed on my laptop before and after my changes were added:

  • TestAccMonitor_CreateRst1
  • TestAccMonitor_CreateDub1
  • TestAccMonitor_MultiRegion_CreateRst1
  • TestAccMonitor_MultiRegion_CreateDub1
  • TestAccMonitor_MultiRegion_Create_Default_Region

Integration test error stdout

I figured it had something to do with my local network's DNS not being configured to resolve the API URLs used in the tests (I guess the docker containers bridged to my laptop), so I figured Travis CI would be the gatekeeper in this discrepancy. The errors were present on the master branch before my additions and are still there afterward, so I'm confident my additions at least didn't make things worse. If this is an actual bug and not an issue with my environment, I can work on a separate bug-hunting branch.

The provider does compile and I tested it against the docker-compose local-env and my Antsle device. It works on my Antsle device perfectly, and 3/4 resources get created with the swaggercodegen example on terraform apply (terraform validate and terraform plan work fine).

swaggercodegen_firewall_failure

I think it's because the resource name has more than one number character in it; I noticed when adding my unit tests that the ConvertToTerraformCompliantName function cannot handle more than one distinct number in a field name. Once again, I can work on this in a separate bug branch if we're in agreement.

In the ConvertToTerraformCompliantName func
Before first check for returning, otherwise a snakeCase string with
colons will be returned when it is not actually a compliant name
The ConvertToTerraformCompliantName function cannot handle multiple
number characters in a name.
@dikhan
Copy link
Owner

dikhan commented Jun 28, 2021

Hi @bradthebuilder , thanks for opening the PR! I just had a baby so most likely won't have time to look into this for a little while. I am expecting to come back to work in couple weeks. I will review the PR and provide feedback then. Sorry for the delay!

@dikhan
Copy link
Owner

dikhan commented Jul 20, 2021

Hey @bradthebuilder ,

Thanks for contributing! The PR looks good, I went ahead and merged the new commits from master to bring this PR up to date. I see the CI build job is failing and I am guessing it's due to the build job being triggered from a fork and the docker login complaining about not being able to perform an interactive login. I was trying to push a new commit against your upstream master and even the feature/support-colon-chars but I am getting permissions denied. Usually I am able to contribute back to PRs created by contributors by pushing new commits against their upstream branches but it's not this time for some reason, not sure what I am missing. Any thoughts?

Alternatively I can create a new PR against a new branch I pushed which contains the latest from master, your commits and the new commit that I wanted to add, you can check out the branch here: https://github.com/dikhan/terraform-provider-openapi/commits/bradthebuilder-master

Let me know

@bradthebuilder
Copy link
Contributor Author

Howdy @dikhan ,

I admit, I'm a bit rusty with GitHub permissions because I do most of my work on Gitlab, but I just tried inviting you as a Collaborator to my fork; maybe accepting that invitation will allow you to push against my master branch? If that didn't do the trick, I'll consult GitHub's documentation on Friday to see if it's something obvious I missed. Failing that, we can fall back to your suggestion of a new branch for plan B.

I did make make another commit on my feature/terraform-gte-1.0.0 branch that adjusts /scripts/install.sh to accept Terraform versions greater than or equal to 1.0.0 that we can also look at a PR for once we get this first one ironed out. Thanks for allowing me to contribute!

@dikhan dikhan closed this Jul 22, 2021
@dikhan dikhan reopened this Jul 22, 2021
@dikhan dikhan force-pushed the master branch 5 times, most recently from 2500be6 to e945e54 Compare July 22, 2021 03:25
@dikhan
Copy link
Owner

dikhan commented Jul 22, 2021

Hey @bradthebuilder ,

I managed to push to your fork in the end but unfortunately was not able to fix the issue with the builds not working in forks. Looks like in Travis CI encrypted environment variables are not available to pull requests from forks due to the security risk of exposing such information to unknown code, and hence commands like docker login used to be able to run the integration tests in the pipeline fail to execute from forks.

Considering the build was failing due to reasons not related to this PR and also having confirmed that all the tests passed locally I feel confortable merging the PR even if the build is red. Once the PR is merged, all the tests will kick off again and this time they will execute properly since the build would be triggered from this repo itself. For the record I am attaching the output of the tests results run locally:

PR306_test_results_run_locally.txt

Lastly, @bradthebuilder I just wanted to let you know that the Publishing OpenAPI Terraform providers in the Terraform Registry doc has instructions on how to leverage the OpenAPI Terraform repo as a library and be able to publish your own Terraform provider (powered by the OpenAPI Terraform provider) in the Terraform registry in case you are interested.

With that, thanks again for contributing to the repo!

Dani

@dikhan dikhan assigned dikhan and bradthebuilder and unassigned dikhan Jul 22, 2021
@dikhan dikhan merged commit 382dda8 into dikhan:master Jul 22, 2021
bradthebuilder added a commit to bradthebuilder/terraform-provider-openapi that referenced this pull request Sep 21, 2021
commit 536983e
Merge: d54067c 9bb8276
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Fri Sep 3 09:09:56 2021 -0700

    Merge pull request dikhan#310 from dikhan/release-v2.2.0

    [NewRelease] v2.2.0

commit 9bb8276
Author: dikhan <di.khan.r@gmail.com>
Date:   Fri Sep 3 09:01:49 2021 -0700

    Release v2.2.0

commit d54067c
Merge: 382dda8 0f63ea1
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Fri Sep 3 08:49:30 2021 -0700

    Merge pull request dikhan#309 from dikhan/integrate-terraform-sdk-v2.7.1

    [TechDebt: Issue dikhan#308] Integrate Terraform SDK 2.7.1

commit 0f63ea1
Author: dikhan <di.khan.r@gmail.com>
Date:   Wed Sep 1 19:00:55 2021 -0700

    Integrate Terraform SDK 2.7.1

commit 382dda8
Merge: f4718a1 e945e54
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Wed Jul 21 22:22:33 2021 -0700

    Merge pull request dikhan#306 from bradthebuilder/master

    [FeatureRequest: Issue dikhan#305] Support colon characters in field names

commit e945e54
Merge: 2067311 f4718a1
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Mon Jul 19 16:06:53 2021 -0700

    Merge branch 'master' into master

commit f4718a1
Merge: 6d8b909 21f5806
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Thu Jul 15 11:19:40 2021 -0700

    Merge pull request dikhan#307 from dikhan/release-v2.1.0

    [NewRelease] v2.1.0

commit 21f5806
Author: dikhan <di.khan.r@gmail.com>
Date:   Thu Jul 15 11:11:23 2021 -0700

    Releasing v2.1.0

commit 6d8b909
Merge: 5a7c1e3 ec9d88c
Author: Daniel I. Khan Ramiro <di.khan.r@gmail.com>
Date:   Thu Jul 15 07:59:05 2021 -0700

    Merge pull request dikhan#295 from dikhan/feature/support-for-post-input-model-without-id-2

    [FeatureRequest: Issue dikhan#100] Add support for POST with request schema only containing inputs (required/optional) and response only containing outputs (computed properties)

commit ec9d88c
Author: dikhan <di.khan.r@gmail.com>
Date:   Wed Jul 14 11:29:41 2021 -0700

    go mod dep updates

commit 237d338
Author: dikhan <di.khan.r@gmail.com>
Date:   Wed Jul 14 11:29:33 2021 -0700

    Fix monitor int tests assertions that before were actually resolving to an actual domain

    - The monitor int tests rely on the error output to confirm the API call was made
    against the right reginal endpoint

commit f0f7cf4
Author: Daniel Isaac Khan Ramiro <di.khan.r@gmail.com>
Date:   Mon Jul 12 21:54:55 2021 -0700

    Add more test coverage

commit c4f84e5
Author: Daniel Isaac Khan Ramiro <di.khan.r@gmail.com>
Date:   Mon Jul 12 21:45:59 2021 -0700

    Remove erorr return from isResourceInstanceEndPoint signature

    - The function was never returning any error and therefore consumers of the method
    would check for an error for no reason.

commit a39b4c1
Author: Daniel Isaac Khan Ramiro <di.khan.r@gmail.com>
Date:   Mon Jun 14 21:30:13 2021 -0700

    Add more test coverage for validateRootPath method

commit 9252e2f
Author: Daniel Isaac Khan Ramiro <di.khan.r@gmail.com>
Date:   Wed Feb 10 19:19:33 2021 -0800

    Add support for POST with request schema only containing inputs and
    response model containing computed properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InternalValidate Error on "-" character in swagger.json
2 participants