Skip to content

allow to register Arg at runtime dynamically #51

Description

@capaj

it is currently possible to register a Field onto a class at runtime, by invoking manually like this:

const decoratorFunction = Field({
            type,
            name: relationName,
            isNullable
          })
          decoratorFunction(prototype, fieldName)

however this is not possible with Arg because for dynamically created method, we don't have any metadata. The compileFieldArgs doesn't register any arguments, because calling

var inferedRawArgs = Reflect.getMetadata('design:paramtypes', target.prototype, fieldName);

obviously returns undefined and the whole compileFieldArgs function just returns without doing anything more.

It would be great If we could have some kind of

{registerDynamicArgument} from 'typegql'

registerDynamicArgument(myClass, "myMethod", "myArgumentName", {
            isNullable: true,
            type: String
          })

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions