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

Discuss name collision possibilities when we replace "/" with "." in namespaces #863

Open
nellshamrell opened this issue Jul 19, 2021 · 0 comments
Labels

Comments

@nellshamrell
Copy link
Contributor

Background

In order to request a maven package, the API call would look like this:

curl -X GET https://clearlydefined.io/definitions/maven/mavencentral/com.apollographql.apollo3/apollo-runtime-jvm/3.0.0-dev14" -H "accept: */*"

In this case, the coordinates are maven/mavencentral/com.apollographql.apollo3/apollo-runtime-jvm/3.0.0-dev14

Let's break this down:

  • maven is the type
  • mavencentral is the provider
  • com.apollographql.apollo3 is the namespace
  • apollo-runtime-jvm is the name
  • 3.0.0-dev14 is the revision

When we run this API call:

curl -X GET https://clearlydefined.io/definitions/maven/mavencentral/com.apollographql.apollo3/apollo-runtime-jvm/3.0.0-dev14" -H "accept: */*"

It harvests the component from here.

Notice something in the url - the namespace is "com/apollographql/apollo3" - there are a lot of slashes in there.

The way we translate this namespace into coordinates is to replace the slashes in the namespace with periods.

So "com/apollographql/apollo3" becomes "com.apollographql.apollo3".

We do the same thing with git components that come from gitlab and will need to do the same with Go components (see #862 for more details).

Potential problem

It's unlikely, but it's possible we could run into name collisions by using this technique. For example - these two paths for two different go components would map to the same set of coordinates.

github.com/user/repo/pkg -> ["github.com.user.repo", "pkg"]
github.com/user.repo/pkg -> ["github.com.user.repo", "pkg"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant