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

Refactor nested IDs into structs #337

Merged
merged 2 commits into from Mar 1, 2022

Conversation

sebasslash
Copy link
Contributor

Description

There are a few endpoints which use nested identifiers to identify a resource rather than using the external ID of that resource. As of now the Module Registry API seems to follow this type of pattern, e.g

POST /organizations/:organization_name/registry-modules/:registry_name/:namespace/:name/:provider/versions

In order to keep method signatures readable, I've refactored these nested URL params into structs which represent the set of identifiers used when referencing a resource. The example above would look something like:

type RegistryModuleID struct {
  Organization string
  RegistryName string
  Namespace string
  Name string
  Provider string
}

Not only does this help keep our method signatures compact, but it enables us to keep our validations DRY for more consistency.

@sebasslash sebasslash changed the base branch from main to releases-1.0.x February 28, 2022 19:46
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

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

I like it. Let's update #333, too.

@sebasslash sebasslash merged commit 1b40f4a into releases-1.0.x Mar 1, 2022
@sebasslash sebasslash deleted the sebasslash/multi-id-structs branch March 1, 2022 17:36
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.

None yet

3 participants