MCPcopy Create free account
hub / github.com/2fd/graphdoc / schema

Method schema

plugins/document.schema/index.ts:332–398  ·  view source on GitHub ↗
(schema: Schema)

Source from the content-addressed store, hash-verified

330 }
331
332 schema(schema: Schema): string {
333
334 let definition = html.line(html.keyword('schema') + ' {');
335
336 if (schema.queryType)
337 definition += html.line('') +
338 this.description(schema.queryType.description)
339 .map(line => html.line(html.tab(line)))
340 .join('') +
341
342 html.line(html.tab(
343 html.property('query') + ': ' + html.useIdentifier(schema.queryType, this.url(schema.queryType))
344 ));
345
346 if (schema.mutationType)
347 definition += html.line('') +
348
349 this.description(schema.mutationType.description)
350 .map(line => html.line(html.tab(line)))
351 .join('') +
352
353 html.line(html.tab(
354 html.property('mutation') + ': ' + html.useIdentifier(schema.mutationType, this.url(schema.mutationType))
355 ));
356
357 if (schema.subscriptionType)
358 definition += html.line('') +
359 this.description(schema.subscriptionType.description)
360 .map(line => html.line(html.tab(line)))
361 .join('') +
362
363 html.line(html.tab(
364 html.property('subscription') + ': ' + html.useIdentifier(schema.subscriptionType, this.url(schema.subscriptionType))
365 ));
366
367 definition += html.line('}');
368
369 return [definition]
370 /* .concat(
371 schema.directives
372 .map((directive) => {
373 return html.line(html.comment('DIRECTIVE')) +
374 this.description(directive.description)
375 .map(line => html.line(line))
376 .join('') +
377 this.code(directive.name);
378 }),
379 schema.types
380 .sort((a: SchemaType, b: SchemaType) => {
381 return order[a.kind].localeCompare(order[b.kind]);
382 })
383 .map((type) => {
384 return html.line(html.comment(type.kind)) +
385 this.description(type.description)
386 .map(line => html.line(line))
387 .join('') +
388 this.code(type.name);
389 }))*/

Callers 1

codeMethod · 0.95

Calls 6

descriptionMethod · 0.95
lineMethod · 0.80
keywordMethod · 0.80
tabMethod · 0.80
propertyMethod · 0.80
useIdentifierMethod · 0.80

Tested by

no test coverage detected