Skip to content

[FEATURE] update ACL Token Read endpoint to add expnded parameter#590

Closed
MohamedM216 wants to merge 1 commit intoG-Research:masterfrom
MohamedM216:update-acl-token-readendpoint
Closed

[FEATURE] update ACL Token Read endpoint to add expnded parameter#590
MohamedM216 wants to merge 1 commit intoG-Research:masterfrom
MohamedM216:update-acl-token-readendpoint

Conversation

@MohamedM216
Copy link
Contributor

Description

update ACL Token Read endpoint to add expnded parameter

Related Issues

#531

Additional Context

Checklist

Please make sure to check the following before submitting your pull request:

  • Did you read the contributing guidelines?
  • Did you update the docs?
  • Did you write any tests to validate this change?

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ww also need to implement a test for this new parameter. Ideally, in the test we call the Read operation with expended=false and expanded=true.

Comment on lines -4099 to -4100
Consul.Token.Read(string id, Consul.QueryOptions queryOptions, System.Threading.CancellationToken ct = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Consul.QueryResult<Consul.TokenEntry>>
Consul.Token.Read(string id, System.Threading.CancellationToken ct) -> System.Threading.Tasks.Task<Consul.QueryResult<Consul.TokenEntry>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing an entry from that API list, means that we are breaking backwards compatibility. The user code that calls these overloads will not work anymore.
I suggest adding only one new Read overload with a new parameter and keep the other ones untouched.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any ideas on how to do this? If we add only one overload, how would its signature be?

  • The current third overload Read(string id, QueryOptions queryOptions, CancellationToken ct = default) is called inside other ones, if we call it again in the new overload(that has exanded param), expanded will be ignored.
  • If we add the expandedparam to the current third overload like this Read(string id, QueryOptions queryOptions, bool expanded, CancellationToken ct = default), then call it instead, we will get breaking changes.

So I think we can have a scoped suppression for the warnings to mean that we're not able to change the old overload (the current third overload) as a workaround. I mean we will keep the first two overloads untouched and have pragma warning disable and pragma warning restore around the third overload. then create the new overload public async Task<QueryResult<TokenEntry>> Read(string id, QueryOptions queryOptions, bool expanded, CancellationToken ct = default) and this is the overload that will be called inside all other overloads.

Please, let me know your thoughts about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can change its name to ReadExpanded for example, instead of Read and get rid of all of this headache?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the way to go:
image

It is not a breaking change because we provide all the necessary overloads for backwards compatibility (source and binary compatibility).

@MohamedM216 MohamedM216 force-pushed the update-acl-token-readendpoint branch 3 times, most recently from 953eb96 to 8973848 Compare March 6, 2026 20:55
Assert.Equal(selfTokenEntry.Response.AccessorID, tokenEntry.Response.AccessorID);
}

[Fact]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use Skip.If in the test, then the attribute that needs to be uses is called SkippableFact

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, but the test do not pass. Please investigate and fix.

add unit testfor expanded parameter

fix tests

polishing

style: fix whitespaces

fix test
@MohamedM216 MohamedM216 force-pushed the update-acl-token-readendpoint branch from 93ca936 to 8ec04e9 Compare March 10, 2026 05:30
@MohamedM216
Copy link
Contributor Author

please see #601
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants