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

babel plugin: support input object literals #894

Conversation

josephsavona
Copy link
Contributor

This is an expanded portion of just the plugin changes from #844. Changes:

  • Support parsing and printing inline InputObject expressions.
  • Clear error message when variables appear nested in ways that the Relay runtime cannot interpret.
  • Tests for the above.

@josephsavona
Copy link
Contributor Author

cc @iamchenxin

@josephsavona
Copy link
Contributor Author

@facebook-github-bot import

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in 0285a1e Mar 3, 2016
ghost pushed a commit that referenced this pull request Mar 3, 2016
Summary:Note: this is inspired by and partially based on iamchenxin's work in #767 and #844. Thanks for the head start!

Relay currently assumes that identifying argument values are strings (numbers *sort* of work, but not really). This builds on #894 (which added support to the plugin for parsing/printing literal InputObjects) by allowing identifying arguments to be basically anything - boolean, number, string, or array/object of the the same.

Key changes include:
- Change the `CallValue` type from mixed to an explicit list of the supported types
- Change `forEachRootCallArg` to return both the literal JS value of the argument as well as a serialized key
- Change all callers of `forEachRootCallArg` (and some places that manually inspected the identifying arg) to correctly choose between the identifying argument value (i.e. when constructing a query with it) or the identifying argument key (for use with `RelayRecordStore.{putDataID,getDataID}`).
- Added tests that the writer correctly creates root records with numeric/object identifying argument values.

Closes #895

Reviewed By: yungsters

Differential Revision: D3003201

Pulled By: josephsavona

fb-gh-sync-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
shipit-source-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
venepe pushed a commit to venepe/relay that referenced this pull request Mar 7, 2016
Summary:This is an expanded portion of just the plugin changes from [facebook#844](facebook#844). The goal of that PR is to support arbitrary values in identifying arguments. Part of that means supporting input objects, which we didn't fully support in the plugin (we only allowed the value of an input object argument to be a variable, not a literal).

Changes:
- Support parsing and printing literal InputObject expressions.
- Clear error message when variables appear nested in ways that the Relay runtime cannot interpret.
- Tests for the above.

Closes facebook#894

Reviewed By: yungsters

Differential Revision: D3002163

Pulled By: josephsavona

fb-gh-sync-id: d7708b36bc087bdd744c4d027cf4b888e8350798
shipit-source-id: d7708b36bc087bdd744c4d027cf4b888e8350798
venepe pushed a commit to venepe/relay that referenced this pull request Mar 7, 2016
Summary:Note: this is inspired by and partially based on iamchenxin's work in facebook#767 and facebook#844. Thanks for the head start!

Relay currently assumes that identifying argument values are strings (numbers *sort* of work, but not really). This builds on facebook#894 (which added support to the plugin for parsing/printing literal InputObjects) by allowing identifying arguments to be basically anything - boolean, number, string, or array/object of the the same.

Key changes include:
- Change the `CallValue` type from mixed to an explicit list of the supported types
- Change `forEachRootCallArg` to return both the literal JS value of the argument as well as a serialized key
- Change all callers of `forEachRootCallArg` (and some places that manually inspected the identifying arg) to correctly choose between the identifying argument value (i.e. when constructing a query with it) or the identifying argument key (for use with `RelayRecordStore.{putDataID,getDataID}`).
- Added tests that the writer correctly creates root records with numeric/object identifying argument values.

Closes facebook#895

Reviewed By: yungsters

Differential Revision: D3003201

Pulled By: josephsavona

fb-gh-sync-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
shipit-source-id: 43ffbbd37e8d2bd8c0abe2cb792ad8959efb7a42
@Visva92 Visva92 mentioned this pull request Mar 8, 2021
Closed
@@ -34,7 +34,7 @@ var q = (function () {
metadata: {
isPlural: true,
identifyingArgName: 'query',
identifyingArgType: '[SearchInput!]'
Copy link

Choose a reason for hiding this comment

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

scripts/babel-relay-plugin/src/tests/testschema.rfc.json

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants