meilisearch / meilisearch-java

Java client for Meilisearch

Home Page:https://meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TenantTokenOptions in wrong location (or package)

jrhenderson1988 opened this issue · comments

Description
The class TenantTokenOptions is located in the file com/meilisearch/sdk/model/TenantTokenOptions.java (notice the model folder), however it is declared with the package com.meilisearch.sdk (no model).

In Java, it is conventional that folder structures follow package names (each . can be replaced to a path separator - / or \). Since the library compiles fine, I don't anticipate that this causes any actual problems, but it does cause IDE warnings/errors in Intellij.

My suggestion to fix this without causing any API breakage to consumers of the SDK, is to move this class to com/meilisearch/sdk/TenantTokenOptions.java.

I am happy to submit a pull request to fix this if you're happy with the suggested fix.

Expected behavior
The package name of each class should reflect the folder structure

Current behavior
The package name does not reflect the folder structure and IDEs throw up warnings.

Screenshots or Logs
image
image

Hello @jrhenderson1988
thanks for the report

I'm not sure to understand how your fix cannot be breaking for the users (I'm not an expert in Java). Can you explain a little bit? Or maybe I would better understand with the open PR...?

Hey @curquiza

I wouldn't expect the fix to be breaking, because existing consumers of the API would be importing that particular class using its package name (rather than the path as it is defined in the filesystem), like this:

import com.meilisearch.sdk.TenantTokenOptions;
// ...
TenantTokenOptions tto = new TenantTokenOptions();

My suggested fix would not change the package name of that particular class. It would instead just move the file up one directory so that the package name matches the file path. No content would be changed.

Since the declared package would not be changed, existing consumers of the API would still be importing from the same place.

I'll create a pull request to demonstrate the change.

Thank you @jrhenderson1988 for the explanation!
Looking at your PR in the coming week

No problem @curquiza - happy to help. Let me know if you need anything else from me on this 🙂