Skip to content

Implement optional list expansion.#37

Merged
bigkevmcd merged 1 commit intomainfrom
api-client-expand-list
Mar 16, 2023
Merged

Implement optional list expansion.#37
bigkevmcd merged 1 commit intomainfrom
api-client-expand-list

Conversation

@bigkevmcd
Copy link
Copy Markdown
Collaborator

This allows the apiClient generator to optionally generate a single element with the entire body of the response.

Combined with the repeat functionality, this allows for a set of resources to be generated from any response.

@bigkevmcd bigkevmcd marked this pull request as ready for review March 2, 2023 10:45
@bigkevmcd bigkevmcd requested a review from a team March 2, 2023 10:45
@bigkevmcd bigkevmcd force-pushed the api-client-expand-list branch from 838ab6b to 2ebd455 Compare March 13, 2023 11:08
Comment thread api/v1alpha1/gitopsset_types.go Outdated
//
// +kubebuilder:default=true
// +optional
ExpandList bool `json:"expandList,omitempty"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in this case... the json serializer will omit it if its false, which will then set it to true if you re-read?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well caught :-D

thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. you brought this up before, its tricky this ay.. if you create a minimal gitopsset via golang and don't specify ExpandList, then you'll create it in a non-default state, vs. creating it via applying a yaml without specifying ExpandList? Its not a huge deal you just have to be a bit careful occasionally.

Any nice antonyms?

  • disableListExpansion
  • collapseList
  • treatListAsSingleEntity
  • listAsSingleEntity
  • singleIteration

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And its nice to have familiar names to other projects like kluctl

@bigkevmcd bigkevmcd force-pushed the api-client-expand-list branch 2 times, most recently from 1fa72ac to 3bc4f97 Compare March 15, 2023 14:17
Comment thread api/v1alpha1/gitopsset_types.go Outdated
//
// +kubebuilder:default=true
// +optional
SingleElement bool `json:"singleElement"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default: false + omitempty now I guess?

Copy link
Copy Markdown
Collaborator

@foot foot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

This allows the apiClient generator to optionally generate a single
element with the entire body of the response.

Combined with the repeat functionality, this allows for a set of
resources to be generated from any response.
@bigkevmcd bigkevmcd force-pushed the api-client-expand-list branch from 3bc4f97 to 8424fac Compare March 16, 2023 09:33
@bigkevmcd bigkevmcd merged commit ad5dcac into main Mar 16, 2023
@bigkevmcd bigkevmcd deleted the api-client-expand-list branch March 16, 2023 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants