public static NameString GetOriginalName( this INamedSyntaxNode typeDefinition, NameString schemaName) { if (typeDefinition == null) { throw new ArgumentNullException(nameof(typeDefinition)); } schemaName.EnsureNotEmpty(nameof(schemaName)); DirectiveNode sourceDirective = typeDefinition.Directives .FirstOrDefault(t => HasSourceDirective(t, schemaName)); if (sourceDirective != null) { ArgumentNode argument = sourceDirective.Arguments.First(t => DirectiveFieldNames.Source_Name.Equals(t.Name.Value)); if (argument.Value is StringValueNode value) { return(value.Value); } } return(typeDefinition.Name.Value); }
public static bool IsFromSchema( this INamedSyntaxNode typeDefinition, NameString schemaName) { if (typeDefinition == null) { throw new ArgumentNullException(nameof(typeDefinition)); } schemaName.EnsureNotEmpty(nameof(schemaName)); return(typeDefinition.Directives.Any(t => HasSourceDirective(t, schemaName))); }