def test_purge_directives_retain_federation_directives(): type_defs = """ type Query { rootField: String } type Review @key(fields: "id") { id: ID! body: String author: User @provides(fields: "email") product: Product @provides(fields: "upc") } type User @key(fields: "email") @extends { email: String @external reviews: [Review] } type Product @key(fields: "upc") @extends { upc: String @external reviews: [Review] } """ assert sic(purge_schema_directives(type_defs)) == sic(type_defs)
def test_purge_directives_remove_custom_directives(): type_defs = """ directive @custom on FIELD type Query { rootField: String @custom } """ assert sic(purge_schema_directives(type_defs)) == sic(""" type Query { rootField: String } """)
def test_purge_directives_retain_builtin_directives(): type_defs = """ type Query { rootField: String } type Product { upc: ID! name: String label: String @deprecated(reason: "Use name instead") } """ assert sic(purge_schema_directives(type_defs)) == sic(type_defs)
def test_purge_directives_remove_custom_directives_with_single_line_description( ): type_defs = """ "Any Description" directive @custom on FIELD type Query { rootField: String @custom } """ assert sic(purge_schema_directives(type_defs)) == sic(""" type Query { rootField: String } """)
def test_purge_directives_remove_custom_directives_with_block_string_description( ): type_defs = ''' """ Any Description """ directive @custom on FIELD type Query { rootField: String @custom } ''' assert sic(purge_schema_directives(type_defs)) == sic(""" type Query { rootField: String } """)