diff --git a/local-codegen.yml b/local-codegen.yml index 94cef426..d3efd901 100644 --- a/local-codegen.yml +++ b/local-codegen.yml @@ -10,5 +10,6 @@ config: maybeValue: T typesPrefix: GQL inlineFragmentTypes: combine + enumsAsTypes: true scalars: StringOrNull: "string | null" diff --git a/src/schema.ts b/src/schema.ts index 09521364..9d90fe22 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -201,6 +201,12 @@ export const typeDefs = gql` width: Int! } + enum LearningpathStepType { + ARTICLE + EXTERNAL + TEXT + } + interface BaseLearningpathStep { id: Int! title: String! @@ -215,7 +221,7 @@ export const typeDefs = gql` revision: Int! status: String! supportedLanguages: [String!]! - type: String! + type: LearningpathStepType! articleId: Int resource(rootId: String, parentId: String): Resource showTitle: Boolean! @@ -237,7 +243,7 @@ export const typeDefs = gql` revision: Int! status: String! supportedLanguages: [String!]! - type: String! + type: LearningpathStepType! articleId: Int resource(rootId: String, parentId: String): Resource showTitle: Boolean! @@ -259,7 +265,7 @@ export const typeDefs = gql` revision: Int! status: String! supportedLanguages: [String!]! - type: String! + type: LearningpathStepType! articleId: Int resource(rootId: String, parentId: String): Resource showTitle: Boolean! @@ -414,7 +420,7 @@ export const typeDefs = gql` language: String! embedUrl: LearningpathEmbedInput showTitle: Boolean! - type: String! + type: LearningpathStepType! license: String copyright: LearningpathCopyrightInput } @@ -428,7 +434,7 @@ export const typeDefs = gql` description: String embedUrl: LearningpathEmbedInput showTitle: Boolean - type: String + type: LearningpathStepType license: String copyright: LearningpathCopyrightInput } diff --git a/src/types/schema.d.ts b/src/types/schema.d.ts index 41338f11..28f6ab6a 100644 --- a/src/types/schema.d.ts +++ b/src/types/schema.d.ts @@ -225,7 +225,7 @@ export type GQLBaseLearningpathStep = { status: Scalars['String']['output']; supportedLanguages: Array; title: Scalars['String']['output']; - type: Scalars['String']['output']; + type: GQLLearningpathStepType; }; @@ -763,7 +763,7 @@ export type GQLLearningpathStep = GQLBaseLearningpathStep & { status: Scalars['String']['output']; supportedLanguages: Array; title: Scalars['String']['output']; - type: Scalars['String']['output']; + type: GQLLearningpathStepType; }; @@ -788,7 +788,7 @@ export type GQLLearningpathStepNewInput = { license?: InputMaybe; showTitle: Scalars['Boolean']['input']; title: Scalars['String']['input']; - type: Scalars['String']['input']; + type: GQLLearningpathStepType; }; export type GQLLearningpathStepOembed = { @@ -800,6 +800,11 @@ export type GQLLearningpathStepOembed = { width: Scalars['Int']['output']; }; +export type GQLLearningpathStepType = + | 'ARTICLE' + | 'EXTERNAL' + | 'TEXT'; + export type GQLLearningpathStepUpdateInput = { articleId?: InputMaybe; copyright?: InputMaybe; @@ -811,7 +816,7 @@ export type GQLLearningpathStepUpdateInput = { revision: Scalars['Int']['input']; showTitle?: InputMaybe; title?: InputMaybe; - type?: InputMaybe; + type?: InputMaybe; }; export type GQLLearningpathUpdateInput = { @@ -1216,7 +1221,7 @@ export type GQLMyNdlaLearningpathStep = GQLBaseLearningpathStep & { status: Scalars['String']['output']; supportedLanguages: Array; title: Scalars['String']['output']; - type: Scalars['String']['output']; + type: GQLLearningpathStepType; }; @@ -2420,6 +2425,7 @@ export type GQLResolversTypes = { LearningpathStepEmbedUrl: ResolverTypeWrapper; LearningpathStepNewInput: GQLLearningpathStepNewInput; LearningpathStepOembed: ResolverTypeWrapper; + LearningpathStepType: GQLLearningpathStepType; LearningpathStepUpdateInput: GQLLearningpathStepUpdateInput; LearningpathUpdateInput: GQLLearningpathUpdateInput; License: ResolverTypeWrapper; @@ -3265,7 +3271,7 @@ export type GQLLearningpathStepResolvers; supportedLanguages?: Resolver, ParentType, ContextType>; title?: Resolver; - type?: Resolver; + type?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }; @@ -3472,7 +3478,7 @@ export type GQLMyNdlaLearningpathStepResolvers; supportedLanguages?: Resolver, ParentType, ContextType>; title?: Resolver; - type?: Resolver; + type?: Resolver; __isTypeOf?: IsTypeOfResolverFn; };