Skip to content

feat: dynamically inferred core types #995

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
wants to merge 51 commits into
base: 22.1
Choose a base branch
from

Conversation

deepjyoti30-st
Copy link
Contributor

@deepjyoti30-st deepjyoti30-st commented Apr 30, 2025

Summary of change

This PR adds support for inferring the querier request body and response body types based on the path entered. It uses the core driver interface spec file to achieve this.

There is a script that generates the updated schema and can be run with the following command, whenever necessary (i.e. whenever the API spec is updated):

npm run build-core-types

Related issues

Test Plan

All tests should pass

Documentation changes

(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)

Checklist for important updates

  • Changelog has been updated
  • coreDriverInterfaceSupported.json file has been updated (if needed)
    • Along with the associated array in lib/ts/version.ts
  • frontendDriverInterfaceSupported.json file has been updated (if needed)
  • Changes to the version if needed
    • In package.json
    • In package-lock.json
    • In lib/ts/version.ts
  • Had run npm run build-pretty
  • Had installed and ran the pre-commit hook
  • If new thirdparty provider is added,
    • update switch statement in recipe/thirdparty/providers/configUtils.ts file, createProvider function.
    • add an icon on the user management dashboard.
  • Issue this PR against the latest non released version branch.
    • To know which one it is, run find the latest released tag (git tag) in the format vX.Y.Z, and then find the latest branch (git branch --all) whose X.Y is greater than the latest released tag.
    • If no such branch exists, then create one from the latest released branch.
  • If have added a new web framework, update the add-ts-no-check.js file to include that
  • If added a new recipe / api interface, then make sure that the implementation of it uses NON arrow functions only (like someFunc: function () {..}).
  • If added a new recipe, then make sure to expose it inside the recipe folder present in the root of this repo. We also need to expose its types.
  • If added a new entry point, then make sure that it is importable by adding it to the exports in package.json

@deepjyoti30-st deepjyoti30-st force-pushed the feat/dynamically-inferred-core-types branch from 8af3ebf to 8a70534 Compare May 9, 2025 06:06
@deepjyoti30-st deepjyoti30-st requested a review from porcellus May 9, 2025 06:07
@deepjyoti30-st deepjyoti30-st marked this pull request as ready for review May 9, 2025 06:07
Copy link

promptless bot commented May 9, 2025

📝 Documentation updates detected! You can review documentation updates here

porcellus and others added 2 commits May 13, 2025 21:42
{
userId: input.userId,
userIdType: input.userIdType,
externalUserIdInfo: input.externalUserIdInfo,
externalUserIdInfo: input.externalUserIdInfo || null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the API spec we define the possible types for externalUserIdInfo to be string | null but the SDK defines them as string | undefined. Do you reckon I change the SDK type definition instead? Or the API spec?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sattvikc what effect does each option have? null clears the mapping, right?

Copy link
Contributor Author

@deepjyoti30-st deepjyoti30-st left a comment

Choose a reason for hiding this comment

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

Leaving replies

@@ -3,6 +3,11 @@
// @ts-nocheck
// @ts-nocheck
// @ts-nocheck
// @ts-nocheck
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this added so many times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

{
userId: input.userId,
userIdType: input.userIdType,
externalUserIdInfo: input.externalUserIdInfo,
externalUserIdInfo: input.externalUserIdInfo || null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sattvikc what effect does each option have? null clears the mapping, right?

Copy link
Contributor Author

@deepjyoti30-st deepjyoti30-st left a comment

Choose a reason for hiding this comment

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

Leaving replies

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