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

Use field configs #1451

Merged
merged 7 commits into from
May 7, 2020
Merged

Use field configs #1451

merged 7 commits into from
May 7, 2020

Commits on May 6, 2020

  1. remove spurious uses of fieldToFieldConfig

    If type.toConfig() is later called returning config, fieldToFieldConfig is called every field to populate config.fields, so no need to call it individually from the field map, might as well just move the toConfig call earlier.
    yaacovCR committed May 6, 2020
    Configuration menu
    Copy the full SHA
    b492e79 View commit details
    Browse the repository at this point in the history
  2. remove need for fieldToFieldConfig function

    BREAKING CHANGE: transformer functions will be passed field config objects instead of field objects.
    
    fieldToFieldConfig was necessary because TransformRootField et al functions expected users to pass a function that receives a field and returns a field config, modified as desired. This can be made easier for end users by simply passing the transformer function a field config instead of a field, obviating the need for fieldToFieldConfig.
    yaacovCR committed May 6, 2020
    Configuration menu
    Copy the full SHA
    78d3702 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fc0cc2f View commit details
    Browse the repository at this point in the history

Commits on May 7, 2020

  1. hoist schema transformation out of type/field loop

    this should be performed only once!
    yaacovCR committed May 7, 2020
    Configuration menu
    Copy the full SHA
    5c42528 View commit details
    Browse the repository at this point in the history
  2. don't mutate previous schemas with HoistField and WrapFields transforms

    fields helper functions now take a schema and return a new schema, rather than mutating the original schema's typemap.
    
    part of broader push throughout the code base to avoid mutating schemas
    
    Note: specifically within the context of transforms, we are currently protected against any side effects when mutating the passed in schema in any case. cloneSchema is used during the transformation loop -- the original schema cannot be mutated by a transformation, because a clone is passed rather than the original. Nevertheless, these changes are part of the overall effort to never rely on the ability to mutate an existing graphql schema.
    yaacovCR committed May 7, 2020
    Configuration menu
    Copy the full SHA
    bbd1c9d View commit details
    Browse the repository at this point in the history
  3. remove use of createNamedStub

    and add comment to explain how this works
    yaacovCR committed May 7, 2020
    Configuration menu
    Copy the full SHA
    4fba6f9 View commit details
    Browse the repository at this point in the history
  4. bring back TypeMap

    yaacovCR committed May 7, 2020
    Configuration menu
    Copy the full SHA
    e48f2b2 View commit details
    Browse the repository at this point in the history