Skip to content

[DOC] inconsistent documentation for usage of openfeature.NewClient #350

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

Open
sahidvelji opened this issue May 14, 2025 · 5 comments
Open
Labels
documentation Improvements or additions to documentation Needs Triage

Comments

@sahidvelji
Copy link
Contributor

Change in the documentation

The documentation for NewClient states

NewClient returns a new Client. Name is a unique identifier for this client This helper exists for historical reasons. It is recommended to interact with IEvaluation to derive IClient instances.

But, all of the documentation uses NewClient: https://openfeature.dev/docs/reference/technologies/server/go

Should NewClient be marked deprecated? Is the following the intended usage?

client := openfeature.GetApiInstance().GetClient()

Should the documentation be updated to replace usage of NewClient with the above?

@sahidvelji sahidvelji added documentation Improvements or additions to documentation Needs Triage labels May 14, 2025
@beeme1mr
Copy link
Member

Hey @sahidvelji, this is a great catch. I think we should depreciate NewClient and consider adding GetDomainClient or something similar. The domain can be used to bind clients to different providers. The readme will need to be updated if we go that route.

FYI, @thomaspoignant @lukas-reining @toddbaert

@toddbaert
Copy link
Member

toddbaert commented May 14, 2025

@sahidvelji ya I think you're right...

I think we should do a couple things:

  • deprecate NewClient
  • deprecate GetNamedClient, and add something like GetDomainClient or GetClientForDomain (interested in your opinion on the name); this is because name has been changed to domain
  • update all but 1-2 tests to these new methods (keep or add at least one for the deprecated method to make sure we don't remove it by accident)
  • update docs/readme

cc @beeme1mr

@beeme1mr
Copy link
Member

I'd probably lean more towards GetDomainClient for brevity. The rest of the plan sounds good.

We should also consider:

  • updating the tutorial on openfeature.dev
  • adding a comment v2 tracking issue to remember to remove the deprecated methods.

@sahidvelji
Copy link
Contributor Author

I think I'd like to better understand the problem first, as the suggested changes are quite significant. What was the intention behind this comment?

This helper exists for historical reasons. It is recommended to interact with IEvaluation to derive IClient instances.

Why not continue using NewClient? Its signature is

func NewClient(domain string) *Client

which already uses the parameter name domain.

deprecate GetNamedClient, and add something like GetDomainClient or GetClientForDomain (interested in your opinion on the name); this is because name has been changed to domain

Given the above, do we need to deprecate NewClient if it already allows the user to specify a domain?

@beeme1mr
Copy link
Member

Functionally, it works, but the names are confusing. Perhaps we could start formalizing a list of 2.0 changes and consider going that route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Needs Triage
Projects
None yet
Development

No branches or pull requests

3 participants