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