feat: docstrings in schema

This commit is contained in:
Vyacheslav Matyukhin 2022-04-26 00:23:31 +04:00
parent 621af946b4
commit 7520c43307
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
3 changed files with 77 additions and 3 deletions

View File

@ -1,7 +1,16 @@
input CreateDashboardInput { input CreateDashboardInput {
"""
The creator of the dashboard, e.g. "Peter Parker"
"""
creator: String creator: String
"""The longer description of the dashboard"""
description: String description: String
"""List of question ids"""
ids: [ID!]! ids: [ID!]!
"""The title of the dashboard"""
title: String! title: String!
} }
@ -10,10 +19,19 @@ type CreateDashboardResult {
} }
type Dashboard { type Dashboard {
"""
The creator of the dashboard, e.g. "Peter Parker"
"""
creator: String! creator: String!
"""The longer description of the dashboard"""
description: String! description: String!
id: ID! id: ID!
"""The list of questions on the dashboard"""
questions: [Question!]! questions: [Question!]!
"""The title of the dashboard"""
title: String! title: String!
} }
@ -21,6 +39,9 @@ type Dashboard {
scalar Date scalar Date
type Mutation { type Mutation {
"""
Create a new dashboard; if the dashboard with given ids already exists then it will be returned instead.
"""
createDashboard(input: CreateDashboardInput!): CreateDashboardResult! createDashboard(input: CreateDashboardInput!): CreateDashboardResult!
} }
@ -31,27 +52,45 @@ type PageInfo {
startCursor: String startCursor: String
} }
"""Platform supported by metaforecast""" """Forecasting platform supported by Metaforecast"""
type Platform { type Platform {
"""
Short unique platform name, e.g. "xrisk"
"""
id: ID! id: ID!
"""
Platform name for displaying on frontend etc., e.g. "X-risk estimates"
"""
label: String! label: String!
} }
type ProbabilityOption { type ProbabilityOption {
name: String name: String
"""0 to 1"""
probability: Float probability: Float
} }
"""Various indicators of the question's quality""" """Various indicators of the question's quality"""
type QualityIndicators { type QualityIndicators {
numForecasts: Int numForecasts: Int
"""0 to 5"""
stars: Int! stars: Int!
} }
type Query { type Query {
"""Look up a single dashboard by its id"""
dashboard(id: ID!): Dashboard! dashboard(id: ID!): Dashboard!
"""Get a list of questions that are currently on the frontpage"""
frontpage: [Question!]! frontpage: [Question!]!
questions(after: String, before: String, first: Int, last: Int): QueryQuestionsConnection! questions(after: String, before: String, first: Int, last: Int): QueryQuestionsConnection!
"""
Search for questions; uses Algolia instead of the primary metaforecast database
"""
searchQuestions(input: SearchInput!): [Question!]! searchQuestions(input: SearchInput!): [Question!]!
} }
@ -67,20 +106,33 @@ type QueryQuestionsConnectionEdge {
type Question { type Question {
description: String! description: String!
"""Unique string which identifies the question"""
id: ID! id: ID!
options: [ProbabilityOption!]! options: [ProbabilityOption!]!
platform: Platform! platform: Platform!
qualityIndicators: QualityIndicators! qualityIndicators: QualityIndicators!
"""Timestamp at which metaforecast fetched the question"""
timestamp: Date! timestamp: Date!
title: String! title: String!
"""
Non-unique, a very small number of platforms have a page for more than one prediction
"""
url: String! url: String!
visualization: String visualization: String
} }
input SearchInput { input SearchInput {
"""List of platform ids to filter by"""
forecastingPlatforms: [String!] forecastingPlatforms: [String!]
"""Minimum number of forecasts on a question"""
forecastsThreshold: Int forecastsThreshold: Int
limit: Int limit: Int
query: String! query: String!
"""Minimum number of stars on a question"""
starsThreshold: Int starsThreshold: Int
} }

File diff suppressed because one or more lines are too long

View File

@ -15,9 +15,13 @@ export type Scalars = {
}; };
export type CreateDashboardInput = { export type CreateDashboardInput = {
/** The creator of the dashboard, e.g. "Peter Parker" */
creator?: InputMaybe<Scalars['String']>; creator?: InputMaybe<Scalars['String']>;
/** The longer description of the dashboard */
description?: InputMaybe<Scalars['String']>; description?: InputMaybe<Scalars['String']>;
/** List of question ids */
ids: Array<Scalars['ID']>; ids: Array<Scalars['ID']>;
/** The title of the dashboard */
title: Scalars['String']; title: Scalars['String'];
}; };
@ -28,15 +32,20 @@ export type CreateDashboardResult = {
export type Dashboard = { export type Dashboard = {
__typename?: 'Dashboard'; __typename?: 'Dashboard';
/** The creator of the dashboard, e.g. "Peter Parker" */
creator: Scalars['String']; creator: Scalars['String'];
/** The longer description of the dashboard */
description: Scalars['String']; description: Scalars['String'];
id: Scalars['ID']; id: Scalars['ID'];
/** The list of questions on the dashboard */
questions: Array<Question>; questions: Array<Question>;
/** The title of the dashboard */
title: Scalars['String']; title: Scalars['String'];
}; };
export type Mutation = { export type Mutation = {
__typename?: 'Mutation'; __typename?: 'Mutation';
/** Create a new dashboard; if the dashboard with given ids already exists then it will be returned instead. */
createDashboard: CreateDashboardResult; createDashboard: CreateDashboardResult;
}; };
@ -53,16 +62,19 @@ export type PageInfo = {
startCursor?: Maybe<Scalars['String']>; startCursor?: Maybe<Scalars['String']>;
}; };
/** Platform supported by metaforecast */ /** Forecasting platform supported by Metaforecast */
export type Platform = { export type Platform = {
__typename?: 'Platform'; __typename?: 'Platform';
/** Short unique platform name, e.g. "xrisk" */
id: Scalars['ID']; id: Scalars['ID'];
/** Platform name for displaying on frontend etc., e.g. "X-risk estimates" */
label: Scalars['String']; label: Scalars['String'];
}; };
export type ProbabilityOption = { export type ProbabilityOption = {
__typename?: 'ProbabilityOption'; __typename?: 'ProbabilityOption';
name?: Maybe<Scalars['String']>; name?: Maybe<Scalars['String']>;
/** 0 to 1 */
probability?: Maybe<Scalars['Float']>; probability?: Maybe<Scalars['Float']>;
}; };
@ -70,14 +82,18 @@ export type ProbabilityOption = {
export type QualityIndicators = { export type QualityIndicators = {
__typename?: 'QualityIndicators'; __typename?: 'QualityIndicators';
numForecasts?: Maybe<Scalars['Int']>; numForecasts?: Maybe<Scalars['Int']>;
/** 0 to 5 */
stars: Scalars['Int']; stars: Scalars['Int'];
}; };
export type Query = { export type Query = {
__typename?: 'Query'; __typename?: 'Query';
/** Look up a single dashboard by its id */
dashboard: Dashboard; dashboard: Dashboard;
/** Get a list of questions that are currently on the frontpage */
frontpage: Array<Question>; frontpage: Array<Question>;
questions: QueryQuestionsConnection; questions: QueryQuestionsConnection;
/** Search for questions; uses Algolia instead of the primary metaforecast database */
searchQuestions: Array<Question>; searchQuestions: Array<Question>;
}; };
@ -114,20 +130,26 @@ export type QueryQuestionsConnectionEdge = {
export type Question = { export type Question = {
__typename?: 'Question'; __typename?: 'Question';
description: Scalars['String']; description: Scalars['String'];
/** Unique string which identifies the question */
id: Scalars['ID']; id: Scalars['ID'];
options: Array<ProbabilityOption>; options: Array<ProbabilityOption>;
platform: Platform; platform: Platform;
qualityIndicators: QualityIndicators; qualityIndicators: QualityIndicators;
/** Timestamp at which metaforecast fetched the question */
timestamp: Scalars['Date']; timestamp: Scalars['Date'];
title: Scalars['String']; title: Scalars['String'];
/** Non-unique, a very small number of platforms have a page for more than one prediction */
url: Scalars['String']; url: Scalars['String'];
visualization?: Maybe<Scalars['String']>; visualization?: Maybe<Scalars['String']>;
}; };
export type SearchInput = { export type SearchInput = {
/** List of platform ids to filter by */
forecastingPlatforms?: InputMaybe<Array<Scalars['String']>>; forecastingPlatforms?: InputMaybe<Array<Scalars['String']>>;
/** Minimum number of forecasts on a question */
forecastsThreshold?: InputMaybe<Scalars['Int']>; forecastsThreshold?: InputMaybe<Scalars['Int']>;
limit?: InputMaybe<Scalars['Int']>; limit?: InputMaybe<Scalars['Int']>;
query: Scalars['String']; query: Scalars['String'];
/** Minimum number of stars on a question */
starsThreshold?: InputMaybe<Scalars['Int']>; starsThreshold?: InputMaybe<Scalars['Int']>;
}; };