Esempio n. 1
0
    public EnumValue(
        ITypeCompletionContext completionContext,
        EnumValueDefinition enumValueDefinition)
    {
        if (completionContext == null)
        {
            throw new ArgumentNullException(nameof(completionContext));
        }

        if (enumValueDefinition is null)
        {
            throw new ArgumentNullException(nameof(enumValueDefinition));
        }

        if (enumValueDefinition.RuntimeValue is null)
        {
            throw new ArgumentException(
                      TypeResources.EnumValue_ValueIsNull,
                      nameof(enumValueDefinition));
        }

        SyntaxNode = enumValueDefinition.SyntaxNode;
        Name       = enumValueDefinition.Name.HasValue
            ? enumValueDefinition.Name
            : (NameString)enumValueDefinition.RuntimeValue.ToString() !;
        Description       = enumValueDefinition.Description;
        DeprecationReason = enumValueDefinition.DeprecationReason;
        IsDeprecated      = !string.IsNullOrEmpty(enumValueDefinition.DeprecationReason);
        Value             = enumValueDefinition.RuntimeValue;
        ContextData       = enumValueDefinition.GetContextData();

        _directives = DirectiveCollection
                      .CreateAndComplete(completionContext, this, enumValueDefinition !.GetDirectives());
    }
Esempio n. 2
0
        protected override void OnCompleteType(
            ITypeCompletionContext context,
            SchemaTypeDefinition definition)
        {
            base.OnCompleteType(context, definition);

            Directives =
                DirectiveCollection.CreateAndComplete(context, this, definition.GetDirectives());
            Services = context.Services;
        }
Esempio n. 3
0
    protected override void OnCompleteType(
        ITypeCompletionContext context,
        TDefinition definition)
    {
        base.OnCompleteType(context, definition);

        UpdateRuntimeType(definition);

        _syntaxNode = definition.SyntaxNode;

        _directives = DirectiveCollection.CreateAndComplete(
            context, this, definition.GetDirectives());
    }