Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/graphql/lib/decorators/input-type.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export interface InputTypeOptions {
* If `true`, type will not be registered in the schema.
*/
isAbstract?: boolean;
/**
* If 'true', the input type will be '@oneOf' type.
* More info about '@oneOf' types in the [GraphQL spec](https://spec.graphql.org/September2025/#sec-OneOf-Input-Objects).
*/
isOneOf?: boolean;
}

/**
Expand Down Expand Up @@ -67,6 +72,7 @@ export function InputType(
name: name || target.name,
description: options.description,
isAbstract: options.isAbstract,
isOneOf: options.isOneOf,
};
LazyMetadataStorage.store(() =>
TypeMetadataStorage.addInputTypeMetadata(metadata),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class InputTypeDefinitionFactory {
type: new GraphQLInputObjectType({
name: metadata.name,
description: metadata.description,
isOneOf: metadata.isOneOf,
fields: this.generateFields(metadata, options),
/**
* AST node has to be manually created in order to define directives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export interface ClassMetadata {
extensions?: Record<string, unknown>;
properties?: PropertyMetadata[];
inheritDescription?: boolean;
isOneOf?: boolean; // For '@oneOf' input types
}