graphql/utilities/find_breaking_changes.py
def find_types_added_to_unions(
    old_schema: GraphQLSchema, new_schema: GraphQLSchema
) -> List[DangerousChange]:
    """Find types added to union.

    Given two schemas, returns a list containing descriptions of any dangerous changes
    in the new_schema related to adding types to a union type.
    """
    old_type_map = old_schema.type_map
    new_type_map = new_schema.type_map

    types_added_to_union = []
    for new_type_name, new_type in new_type_map.items():
        old_type = old_type_map.get(new_type_name)
        if not (is_union_type(old_type) and is_union_type(new_type)):
            continue
        old_type = cast(GraphQLUnionType, old_type)
        new_type = cast(GraphQLUnionType, new_type)
        type_names_in_old_union = {type_.name for type_ in old_type.types}
        for type_ in new_type.types:
            type_name = type_.name
            if type_name not in type_names_in_old_union:
                types_added_to_union.append(
                    DangerousChange(
                        DangerousChangeType.TYPE_ADDED_TO_UNION,
                        f"{type_name} was added to union type {new_type_name}.",
                    )
                )
    return types_added_to_union
Find types added to union.

    Given two schemas, returns a list containing descriptions of any dangerous changes
    in the new_schema related to adding types to a union type.
    
Find types added to union.
Given two schemas, returns a list containing descriptions of any dangerous changes
in the new_schema related to adding types to a union type.
Find types added to union . Given two schemas returns a list containing descriptions of any dangerous changes in the new_schema related to adding types to a union type .
def find_types_added_to_unions(
    old_schema: GraphQLSchema, new_schema: GraphQLSchema
) -> List[DangerousChange]:
    old_type_map = old_schema.type_map
    new_type_map = new_schema.type_map
    types_added_to_union = []
    for new_type_name, new_type in new_type_map.items():
        old_type = old_type_map.get(new_type_name)
        if not (is_union_type(old_type) and is_union_type(new_type)):
            continue
        old_type = cast(GraphQLUnionType, old_type)
        new_type = cast(GraphQLUnionType, new_type)
        type_names_in_old_union = {type_.name for type_ in old_type.types}
        for type_ in new_type.types:
            type_name = type_.name
            if type_name not in type_names_in_old_union:
                types_added_to_union.append(
                    DangerousChange(
                        DangerousChangeType.TYPE_ADDED_TO_UNION,
                        f"{type_name} was added to union type {new_type_name}.",
                    )
                )
    return types_added_to_union
def find_types_added_to_unions ( old_schema : GraphQLSchema , new_schema : GraphQLSchema ) -> List [ DangerousChange ] : old_type_map = old_schema . type_map new_type_map = new_schema . type_map types_added_to_union = [ ] for new_type_name , new_type in new_type_map . items ( ) : old_type = old_type_map . get ( new_type_name ) if not ( is_union_type ( old_type ) and is_union_type ( new_type ) ) : continue old_type = cast ( GraphQLUnionType , old_type ) new_type = cast ( GraphQLUnionType , new_type ) type_names_in_old_union = { type_ . name for type_ in old_type . types } for type_ in new_type . types : type_name = type_ . name if type_name not in type_names_in_old_union : types_added_to_union . append ( DangerousChange ( DangerousChangeType . TYPE_ADDED_TO_UNION , f"{type_name} was added to union type {new_type_name}." , ) ) return types_added_to_union
Find types added to union.
Find types added to union .
"""Find types added to union.

    Given two schemas, returns a list containing descriptions of any dangerous changes
    in the new_schema related to adding types to a union type.
    """
old_schema
GraphQLSchema
new_schema
GraphQLSchema