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 improved mapSchema to make schema package functions not modify existing schema #1456

Merged
merged 8 commits into from
May 11, 2020

Commits on May 8, 2020

  1. refactor WrapFields

    = add enhanceSchema function that can add/replace types/directives, see detailed comment with regard to motivation even for simply adding a new type (vs just using toConfig)
    
    = simplify field helper functions
    
    more complex modifyFields function is not necessary, empty types can be added and later extended so if multiples types with cross-referencing fields need to be added, the types can be added first without fields, and the fields appended later.
    
    = appendFields currently adds fields to a new type if no existing type is found, this functionality perhaps should be made configurable or put in a separate function
    yaacovCR committed May 8, 2020
    Configuration menu
    Copy the full SHA
    4cabc55 View commit details
    Browse the repository at this point in the history

Commits on May 10, 2020

  1. convert default values as leaf values internal values may change when…

    … mapping
    
    this is necessary to eventually replace use of healSchema and forEachDefaultValue within AddResolversToSchema, although use of mapSchema will require that function to be immutable
    yaacovCR committed May 10, 2020
    Configuration menu
    Copy the full SHA
    dd4713e View commit details
    Browse the repository at this point in the history
  2. use TypeMap type

    yaacovCR committed May 10, 2020
    Configuration menu
    Copy the full SHA
    cc4a0e5 View commit details
    Browse the repository at this point in the history
  3. rename functions

    = appendObjectFields and removeObjectFields better describe that these functions only apply to fields of GraphQLObjectType
    
    = enhanceSchema is a bit vague
    yaacovCR committed May 10, 2020
    Configuration menu
    Copy the full SHA
    d2eea3c View commit details
    Browse the repository at this point in the history
  4. fix mapSchema typo

    All input types mapped to input object types!
    yaacovCR committed May 10, 2020
    Configuration menu
    Copy the full SHA
    55f4742 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2020

  1. continue mutable => immutable conversion

    This change:
    = bring default value updating into mapSchema
    
    = change aaddResolversToSchema,
    addCatchUndefinedToSchema, addErrorLoggingToSchema,
    addSchemaLevelResolver to all use mapSchema to return a new schema without modifying the passed in schema
    
    = change all internal use of these functions and all tests to use the return value
    
    = pass typeName instead of a type to field mappers, as passing a type can be confusing, because the type may be in the process of being mapped and not equivalent to the type in the original schema
    
    ** the visitSchema function and the schema directive classes that use visitSchema are the next (final?) target for mutable => immutable conversion
    yaacovCR committed May 11, 2020
    Configuration menu
    Copy the full SHA
    bc5e111 View commit details
    Browse the repository at this point in the history
  2. fix more docs

    yaacovCR committed May 11, 2020
    Configuration menu
    Copy the full SHA
    0f4654c View commit details
    Browse the repository at this point in the history
  3. prune unnecessary field mapper types

    there are only really two types of fields, "composite fields" or "output fields" called "fields" in graphql-js on object and interfaces, and input fields on input objects.
    
    The generic FieldMapper type is useful for internal function mapFields so that field mapping logic does not have to be duplicated between output and input fields because of the different types.
    yaacovCR committed May 11, 2020
    Configuration menu
    Copy the full SHA
    49de733 View commit details
    Browse the repository at this point in the history