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 2 commits into from Mar 1, 2022


Copy link

@sebasslash sebasslash commented Feb 28, 2022


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 Feb 28, 2022
Copy link

@brandonc brandonc left a comment

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

@sebasslash sebasslash merged commit 1b40f4a into releases-1.0.x Mar 1, 2022
4 checks passed
@sebasslash sebasslash deleted the sebasslash/multi-id-structs branch Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants