scanoss / scanoss.java

SCANOSS Java package providing a simple, easy to consume library for interacting with SCANOSS APIs.
https://scanoss.com
MIT License
2 stars 1 forks source link

Default URL constants should be public #11

Open sschuberth opened 1 month ago

sschuberth commented 1 month ago

These are package-private but should be public:

https://github.com/scanoss/scanoss.java/blob/8598c47987bb92490755972e845bd9fe2a6955d8/src/main/java/com/scanoss/rest/ScanApi.java#L238-L239

sschuberth commented 1 month ago

What do you think, @scanossjeronimo?

sschuberth commented 1 month ago

As a somewhat related note, IMO it's a bit weird that the "scan/direct" path is part of the default URL. Usually, the path is specific to the endpoint you're calling, see this code in ORT's own SCANOSS client. The only thing "special" here is that the API just has this single endpoint. But in preparation for eventually having more endpoints, probably only the base URL, without any path, should serve as the default URL.

eeisegn commented 1 month ago

@sschuberth We plan to have an abstract interface covering these (multiple) APIs in the future. For now we only implemented the ScanApi and as such put the full path into it.

Is there a reason you want to be able to have the DEFAULT_SCAN URLs public? I assume you only need read access?

Also, there is the ability to supply the url field during instantiation. Does that satisfy the requirement?

sschuberth commented 1 month ago

Is there a reason you want to be able to have the DEFAULT_SCAN URLs public?

We'd like to be able to fall back explicitly to it if no URL is specified in ORT, see this code.

sschuberth commented 1 month ago

Also, there is the ability to supply the url field during instantiation. Does that satisfy the requirement?

Not sure if that's what you mean, but while I realize that we could simply not pass the URL to the builder / use an explicit null for the URL in order to make the default URL kick in, we prefer to be explicit about the default as part of the configuration.

eeisegn commented 1 month ago

OK. We'll prepare two new variables with public values for the base URL:

public static final String DEFAULT_BASE_URL = "https://api.osskb.org";

public static final String DEFAULT_BASE_URL2 = "https://api.scanoss.com";

Does this work for you?

eeisegn commented 1 month ago

Also, there is the ability to supply the url field during instantiation. Does that satisfy the requirement?

Not sure if that's what you mean, but while I realize that we could simply not pass the URL to the builder / use an explicit null for the URL in order to make the default URL kick in, we prefer to be explicit about the default as part of the configuration.

That field is optional in the builder, so if you won't have a value, you don't have to specify it. However, we will expose the default base path for you, so you can construct the URL.

sschuberth commented 1 month ago

OK. We'll prepare two new variables with public values for the base URL:

Perfect, thanks!