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

506 deprecate name field in API calls #722

Merged
merged 10 commits into from
May 27, 2022

Conversation

kriswest
Copy link
Contributor

resolves #506

Removes the TargetApp union type (string | Appmetadata) which splits the signatures for open, raiseIntent and raiseIntentForContext into two versions, then deprecates the version based on on the name field. Also makes name optional, but appId required and splits AppMetadata into AppIdentifier and AppMetadata which extends it - this helps to clarify what the requirements are for function calls, vs. the return types (thanks for the suggestion @thorsent).

Also:

  • tidies up the deprecated DesktopAgent functions in docs and sources
  • applies markdown linting so some of the docs files

As discussed at #683

@kriswest kriswest added enhancement New feature or request api FDC3 API Working Group labels May 17, 2022
@netlify
Copy link

netlify bot commented May 17, 2022

Deploy Preview for lambent-kulfi-cf51a7 ready!

Name Link
🔨 Latest commit c61b919
🔍 Latest deploy log https://app.netlify.com/sites/lambent-kulfi-cf51a7/deploys/62878b3fbd0e2100092801a7
😎 Deploy Preview https://deploy-preview-722--lambent-kulfi-cf51a7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kriswest kriswest added this to the 2.0-candidates milestone May 17, 2022
Copy link
Contributor

@thorsent thorsent left a comment

Choose a reason for hiding this comment

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

Nice

docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
docs/api/ref/Types.md Outdated Show resolved Hide resolved
docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
kriswest and others added 2 commits May 18, 2022 12:10
Co-authored-by: Hugh Troeger <htroeger@factset.com>
Co-authored-by: Matt Jamieson <10372+mattjamieson@users.noreply.github.com>
@kriswest
Copy link
Contributor Author

Thanks @mattjamieson @greyseer256, suggestions applied

src/api/AppIdentifier.ts Outdated Show resolved Hide resolved
docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
src/api/AppIntent.ts Outdated Show resolved Hide resolved
src/api/AppIntent.ts Outdated Show resolved Hide resolved

export function open(app: AppIdentifier | String, context?: Context): Promise<AppMetadata> {
if (isString(app)) {
return rejectIfNoGlobal(() => window.fdc3.open(app, context));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't these overloads be wrapping the string as an AppIdentifier internally? Otherwise why is there a check and if-else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The typeguard and check were needed as typescript will allow us to declare the different types for the function overload, but in the implementation, javascript won't (the second declaration will just overwrite the first, which typescript knows and will spit out as an error).

Hence, this looks odd in this utility file, but works correctly and looks correct in the types/docs (and provides the overload for use in other languages that actually care about the types of function arguments, which JS does not). Hence, JS implementations will still use a single function to implement both signatures and will have to do some similar type checking internally.

Makes a bit more sense when you see it in VS code and it highlights that one of the calls fdc3.open is the deprecated form:
image

I can't wrap the name as an AppIdentifier internally as we're missing the required appId.

src/api/AppMetadata.ts Outdated Show resolved Hide resolved
src/api/AppIdentifier.ts Outdated Show resolved Hide resolved
src/api/AppIntent.ts Outdated Show resolved Hide resolved
Co-authored-by: Brian Ingenito <28159742+bingenito@users.noreply.github.com>
docs/api/ref/Metadata.md Outdated Show resolved Hide resolved
src/api/AppIntent.ts Outdated Show resolved Hide resolved
@kriswest kriswest mentioned this pull request May 20, 2022
17 tasks
Copy link
Contributor

@nkolba nkolba left a comment

Choose a reason for hiding this comment

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

LGTM

@kriswest kriswest merged commit 13655ac into master May 27, 2022
@kriswest kriswest modified the milestones: 2.0-candidates, 2.0 May 27, 2022
@kriswest kriswest deleted the 506-deprecate-name-field-in-api-calls branch May 27, 2022 10:20
@bingenito bingenito mentioned this pull request Nov 6, 2023
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api FDC3 API Working Group enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate use of the string name field in favour of AppMetadata
6 participants