netascode / terraform-provider-fmc

Mozilla Public License 2.0
1 stars 3 forks source link

gen/templates improvements #62

Open jabielecki opened 1 week ago

jabielecki commented 1 week ago

When To Merge

Best merged after any open big functionality PRs become closed/merged. Otherwise they'll have a big conflict.

Ready for review.

Cosmetic

The go fmt always puts an empty line after a function and before the // End comment. Do the same.

DataSourceNameQuery

There are tests generated now for any use of data_source_name_query.

Refactoring in model.go: swap the branches

In model.go: swap the branches. It's more readable when a special case (break) is handled inside an if block and normal case outside of if block.

Behavior stays the same.

don't mix tabs/spaces

This is whitespace-only, nevermind that git decided to have a big non-whitespace diff for it, somehow.

I've tested this with a following dummy.yaml:

---
name: Dummy
rest_endpoint: /dummy
data_source_name_query: true
# test_tags: [DUMMY]
attributes:
  - model_name: name
    type: String
    mandatory: true
  - model_name: continents
    type: List
    # test_tags: [DUMMY]
    mandatory: true
    attributes:
      - model_name: countries
        type: List
        # test_tags: [DUMMY]
        mandatory: true
        attributes:
          - model_name: cities
            type: List
            # test_tags: [DUMMY]
            mandatory: true
            attributes:
              - model_name: buildings
                # test_tags: [DUMMY]
                type: List
                mandatory: true
                element_type: String
                example: StPeters