Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Extensions decorator don't work on @Field included in @InputType #3328

Open
1 task done
Vittorio1970 opened this issue Oct 10, 2024 · 2 comments
Open
1 task done

Comments

@Vittorio1970
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

@ObjectType()

export class SampleOutput {
  **@Extensions({ key: 'Value present in extensions member' })**
  @Field({
    nullable: true,
  })
  errorMessage: string;
}

Result

{
  name: "errorMessage",
  description: undefined,
  type: { ........ },
  args: [],
  resolve: (source, args, contextValue, info) => { ..... },
  subscribe: undefined,
  deprecationReason: undefined,
  extensions: {
    complexity: undefined,
    **key: "Value present in fieldconfig",**
  },
  astNode: undefined,
}

@inputType()

export class SampleInput {
  @Extensions({ key: 'Value not present in field config' })
  @Field({
    nullable: false,
    defaultValue: false,
  })
  forceCreation: boolean;
}

Result

{
  name: "forceCreation",
  description: undefined,
  type: { .... },
  defaultValue: false,
  deprecationReason: undefined,
  **extensions: {
  },**
  astNode: undefined,
}

Describe the solution you'd like

Same behavior for fields included in both InputType and ObjectType

Teachability, documentation, adoption, migration strategy

.

What is the motivation / use case for changing the behavior?

.

@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

@Vittorio1970
Copy link
Author

Vittorio1970 commented Oct 23, 2024

https://codesandbox.io/p/devbox/friendly-newton-lnjrc3

Info from the schema handler

[Object: null prototype] { OtypeMember: { name: 'OtypeMember', description: undefined, type: GraphQLScalarType { name: 'String', description: 'TheStringscalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', specifiedByURL: undefined, serialize: [Function: serialize], parseValue: [Function: parseValue], parseLiteral: [Function: parseLiteral], extensions: [Object: null prototype] {}, astNode: undefined, extensionASTNodes: [] }, args: [], resolve: [Function: rootFieldResolver], subscribe: undefined, deprecationReason: undefined, extensions: [Object: null prototype] { complexity: undefined, key: 'value' }, astNode: undefined } } [Object: null prototype] { ItypeMember: { name: 'ItypeMember', description: undefined, type: GraphQLScalarType { name: 'String', description: 'TheStringscalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', specifiedByURL: undefined, serialize: [Function: serialize], parseValue: [Function: parseValue], parseLiteral: [Function: parseLiteral], extensions: [Object: null prototype] {}, astNode: undefined, extensionASTNodes: [] }, defaultValue: undefined, deprecationReason: undefined, extensions: [Object: null prototype] {}, astNode: undefined } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants