@@ -1253,85 +1253,42 @@ def fails_as_expected_on_the_type_root_field_without_an_arg():
1253
1253
],
1254
1254
)
1255
1255
1256
- def exposes_descriptions_on_types_and_fields ():
1256
+ def exposes_descriptions ():
1257
1257
schema = build_schema (
1258
- """
1259
- type Query {
1260
- someField: String
1258
+ '''
1259
+ """Enum description"""
1260
+ enum SomeEnum {
1261
+ """Value description"""
1262
+ VALUE
1261
1263
}
1262
- """
1263
- )
1264
1264
1265
- source = """
1266
- {
1267
- schemaType: __type(name: "__Schema") {
1268
- name,
1269
- description,
1270
- fields {
1271
- name,
1272
- description
1273
- }
1274
- }
1265
+ """Object description"""
1266
+ type SomeObject {
1267
+ """Field description"""
1268
+ someField(arg: SomeEnum): String
1275
1269
}
1276
- """
1277
-
1278
- assert graphql_sync (schema = schema , source = source ) == (
1279
- {
1280
- "schemaType" : {
1281
- "name" : "__Schema" ,
1282
- "description" : "A GraphQL Schema defines the capabilities of a"
1283
- " GraphQL server. It exposes all available types and"
1284
- " directives on the server, as well as the entry points"
1285
- " for query, mutation, and subscription operations." ,
1286
- "fields" : [
1287
- {"name" : "description" , "description" : None },
1288
- {
1289
- "name" : "types" ,
1290
- "description" : "A list of all types supported"
1291
- " by this server." ,
1292
- },
1293
- {
1294
- "name" : "queryType" ,
1295
- "description" : "The type that query operations"
1296
- " will be rooted at." ,
1297
- },
1298
- {
1299
- "name" : "mutationType" ,
1300
- "description" : "If this server supports mutation, the type"
1301
- " that mutation operations will be rooted at." ,
1302
- },
1303
- {
1304
- "name" : "subscriptionType" ,
1305
- "description" : "If this server support subscription,"
1306
- " the type that subscription operations will be rooted at." ,
1307
- },
1308
- {
1309
- "name" : "directives" ,
1310
- "description" : "A list of all directives supported"
1311
- " by this server." ,
1312
- },
1313
- ],
1314
- }
1315
- },
1316
- None ,
1317
- )
1318
1270
1319
- def exposes_descriptions_on_enums ():
1320
- schema = build_schema (
1321
- """
1322
- type Query {
1323
- someField: String
1271
+ """Schema description"""
1272
+ schema {
1273
+ query: SomeObject
1324
1274
}
1325
- """
1275
+ '''
1326
1276
)
1327
1277
1328
1278
source = """
1329
1279
{
1330
- typeKindType: __type(name: "__TypeKind") {
1331
- name,
1280
+ Schema: __schema { description }
1281
+ SomeObject: __type( name: "SomeObject") {
1332
1282
description,
1283
+ fields {
1284
+ name
1285
+ description
1286
+ }
1287
+ }
1288
+ SomeEnum: __type(name: "SomeEnum") {
1289
+ description
1333
1290
enumValues {
1334
- name,
1291
+ name
1335
1292
description
1336
1293
}
1337
1294
}
@@ -1340,53 +1297,27 @@ def exposes_descriptions_on_enums():
1340
1297
1341
1298
assert graphql_sync (schema = schema , source = source ) == (
1342
1299
{
1343
- "typeKindType" : {
1344
- "name" : "__TypeKind" ,
1345
- "description" : "An enum describing what kind of type"
1346
- " a given `__Type` is." ,
1300
+ "Schema" : {
1301
+ "description" : "Schema description" ,
1302
+ },
1303
+ "SomeEnum" : {
1304
+ "description" : "Enum description" ,
1347
1305
"enumValues" : [
1348
1306
{
1349
- "name" : "SCALAR" ,
1350
- "description" : "Indicates this type is a scalar." ,
1351
- },
1352
- {
1353
- "name" : "OBJECT" ,
1354
- "description" : "Indicates this type is an object."
1355
- + " `fields` and `interfaces` are valid fields." ,
1356
- },
1357
- {
1358
- "name" : "INTERFACE" ,
1359
- "description" : "Indicates this type is an interface."
1360
- " `fields`, `interfaces`, and `possibleTypes`"
1361
- " are valid fields." ,
1362
- },
1363
- {
1364
- "name" : "UNION" ,
1365
- "description" : "Indicates this type is a union."
1366
- " `possibleTypes` is a valid field." ,
1367
- },
1368
- {
1369
- "name" : "ENUM" ,
1370
- "description" : "Indicates this type is an enum."
1371
- " `enumValues` is a valid field." ,
1372
- },
1373
- {
1374
- "name" : "INPUT_OBJECT" ,
1375
- "description" : "Indicates this type is an input object."
1376
- " `inputFields` is a valid field." ,
1377
- },
1378
- {
1379
- "name" : "LIST" ,
1380
- "description" : "Indicates this type is a list."
1381
- " `ofType` is a valid field." ,
1307
+ "name" : "VALUE" ,
1308
+ "description" : "Value description" ,
1382
1309
},
1310
+ ],
1311
+ },
1312
+ "SomeObject" : {
1313
+ "description" : "Object description" ,
1314
+ "fields" : [
1383
1315
{
1384
- "name" : "NON_NULL" ,
1385
- "description" : "Indicates this type is a non-null."
1386
- " `ofType` is a valid field." ,
1316
+ "name" : "someField" ,
1317
+ "description" : "Field description" ,
1387
1318
},
1388
1319
],
1389
- }
1320
+ },
1390
1321
},
1391
1322
None ,
1392
1323
)
0 commit comments