/** * Copyright (c) 2021 GraphQL Contributors. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React from 'react'; import TypeLink from './TypeLink'; import MarkdownContent from './MarkdownContent'; import { GraphQLSchema } from 'graphql'; import { OnClickTypeFunction } from './types'; type SchemaDocProps = { schema: GraphQLSchema; onClickType: OnClickTypeFunction; }; // Render the top level Schema export default function SchemaDoc({ schema, onClickType }: SchemaDocProps) { const queryType = schema.getQueryType(); const mutationType = schema.getMutationType && schema.getMutationType(); const subscriptionType = schema.getSubscriptionType && schema.getSubscriptionType(); return (
{'root types'}
{'query'} {': '}
{mutationType && (
{'mutation'} {': '}
)} {subscriptionType && (
{'subscription'} {': '}
)}
); }