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

overloaded choices in json-api #14410

Merged
merged 54 commits into from
Jul 27, 2022
Merged

Conversation

S11001001
Copy link
Contributor

@S11001001 S11001001 commented Jul 13, 2022

Fixes #13923.

CHANGELOG_BEGIN
- [JSON API] For exercise endpoints, when multiple choices with the same
  name are defined, the one directly defined on the ``templateId``,
  which may be a template or interface ID, will be selected; if a
  template ID is specified that only inherits the choices with the same
  name, the new ``choiceInterfaceId`` option must be specified to select
  the source of the choice.
CHANGELOG_END
  • 3 overload integration tests
  • add changelog

@S11001001 S11001001 added component/json-api HTTP JSON API team/ledger-clients Related to the Ledger Clients team's components. labels Jul 13, 2022
@S11001001 S11001001 self-assigned this Jul 13, 2022
S11001001 added 26 commits July 13, 2022 14:25
@S11001001 S11001001 marked this pull request as ready for review July 21, 2022 22:23
@S11001001 S11001001 requested a review from a team July 21, 2022 22:23
Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da left a comment

Choose a reason for hiding this comment

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

This looks reasonable.

Just few naive questions.

locator: domain.ContractLocator[v.Value],
to: domain.Party,
choice: TExercise[Inj],
choiceInterfaceId: Option[domain.ContractTypeId.Interface.OptionalPkg] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why choiceInterfaceId is not a field of TExercise ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason, take a look at 9757fb0 and let me know what you think.

f: PackageService.ResolveTemplateRecordType,
g: PackageService.ResolveChoiceArgType,
h: PackageService.ResolveKeyType,
): Error \/ LfType =
) =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we drop the type signature ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specifying the type signature of an override is usually pointless noise, and this change makes this one pointless and wrong noise. The only signal to be had is in the definition of type TypeFromCtId immediately above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK.

Copy link
Contributor

Choose a reason for hiding this comment

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

Specifying the type signature of an override is usually pointless noise, and this change makes this one pointless and wrong noise. The only signal to be had is in the definition of type TypeFromCtId immediately above.

I don't think it is. Having the signature fully available makes it easy to understand what the function does at a glance without having to go through the inheritance hiearachy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a typeclass and its instances. We don't restate the types of typeclass methods in every instance for the same reason.

Copy link
Contributor

@stefanobaghino-da stefanobaghino-da left a comment

Choose a reason for hiding this comment

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

Mostly a documentation review.

My eye slipped on a couple of implementation details and I added a comment there as well.

f: PackageService.ResolveTemplateRecordType,
g: PackageService.ResolveChoiceArgType,
h: PackageService.ResolveKeyType,
): Error \/ LfType =
) =
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifying the type signature of an override is usually pointless noise, and this change makes this one pointless and wrong noise. The only signal to be had is in the definition of type TypeFromCtId immediately above.

I don't think it is. Having the signature fully available makes it easy to understand what the function does at a glance without having to go through the inheritance hiearachy.

docs/source/json-api/index.rst Show resolved Hide resolved
@stefanobaghino-da stefanobaghino-da dismissed their stale review July 27, 2022 05:46

Documentation improvements addressed in 0eeb531

@stefanobaghino-da
Copy link
Contributor

I removed my blocker since the documentation has been improved as required by 0eeb531. Thank you, @S11001001.

@S11001001 S11001001 enabled auto-merge (squash) July 27, 2022 13:48
@S11001001 S11001001 merged commit 1a9dc02 into main Jul 27, 2022
@S11001001 S11001001 deleted the 13923-overloaded-choices-json-api branch July 27, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/json-api HTTP JSON API team/ledger-clients Related to the Ledger Clients team's components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support interface inheritance of same-named choices in json-api
3 participants