private Schema TypeSchemaFactory(Type type, ISchemaRepository schemaRepository) { var schema = GetSchemaIfPrimitive(type); if (schema != null) { return(schema); } schema = GetSchemaIfEnumerable(type, schemaRepository); if (schema != null) { return(schema); } var filter = _options.PropertyFilter ?? ((_) => true); var propertyAndFieldMembers = type.GetProperties() .Where(filter) .Cast <MemberInfo>() .Concat(type.GetFields()).ToArray(); return(CreateSchemaFromPropertyAndFieldMembers(schemaRepository, propertyAndFieldMembers)); }
protected override GraphQLValue GetAst(object value, ISchemaRepository schemaRepository) { if (value is bool) { value = value.ToString().ToLower(); } var stringValue = value.ToString(); if (stringValue.ParseIntOrGiveNull() != null) { return new GraphQLScalarValue(ASTNodeKind.IntValue) { Value = stringValue } } ; return(new GraphQLScalarValue(ASTNodeKind.StringValue) { Value = Regex.Escape(stringValue) }); } }
public IQueryable <SchemaVersion> GetSchemaVersions( [Service] ISchemaRepository repository) => repository.GetSchemaVersions();
public IQueryable <SchemaPublishReport> GetPublishReports( [Parent] SchemaVersion schemaVersion, [Service] ISchemaRepository repository) => repository.GetPublishReports().Where(t => t.SchemaVersionId == schemaVersion.Id);
protected abstract GraphQLBaseType GetSchemaType(Type type, ISchemaRepository schemaRepository);
public OperationFilterContext(MethodInfo method, ISchemaRepository schemaRepository, OperationAttribute operation) { Method = method; SchemaRepository = schemaRepository; Operation = operation; }
public ChannelItemFilterContext(MethodInfo method, ISchemaRepository schemaRepository, ChannelAttribute channel) { Method = method; SchemaRepository = schemaRepository; Channel = channel; }
public KnownArgumentNamesVisitor(IGraphQLSchema schema) : base(schema) { this.schemaRepository = schema.SchemaRepository; this.Errors = new List <GraphQLException>(); }
/// <summary> /// Generate the Channels section of the AsyncApi schema from the <see cref="ChannelAttribute"/> on classes. /// </summary> private Channels GenerateChannelsFromClasses(IEnumerable <TypeInfo> asyncApiTypes, ISchemaRepository schemaRepository) { var channels = new Channels(); var classesWithChannelAttribute = asyncApiTypes .Select(type => new { Channel = type.GetCustomAttribute <ChannelAttribute>(), Type = type, }) .Where(cc => cc.Channel != null); foreach (var cc in classesWithChannelAttribute) { var channelItem = new ChannelItem { Description = cc.Channel.Description, Parameters = cc.Channel.Parameters, Publish = GenerateOperationFromClass(cc.Type, schemaRepository, OperationType.Publish), Subscribe = GenerateOperationFromClass(cc.Type, schemaRepository, OperationType.Subscribe), }; channels.Add(cc.Channel.Name, channelItem); var context = new ChannelItemFilterContext(cc.Type, schemaRepository, cc.Channel); foreach (var filter in _options.ChannelItemFilters) { filter.Apply(channelItem, context); } } return(channels); }
/// <summary> /// Generate the Channels section of the AsyncApi schema from the <see cref="ChannelAttribute"/> on methods. /// </summary> private Channels GenerateChannelsFromMethods(IEnumerable <TypeInfo> asyncApiTypes, ISchemaRepository schemaRepository) { var channels = new Channels(); var methodsWithChannelAttribute = asyncApiTypes .SelectMany(type => type.DeclaredMethods) .Select(method => new { Channel = method.GetCustomAttribute <ChannelAttribute>(), Method = method, }) .Where(mc => mc.Channel != null); foreach (var mc in methodsWithChannelAttribute) { var channelItem = new ChannelItem { Description = mc.Channel.Description, Parameters = mc.Channel.Parameters, Publish = GenerateOperationFromMethod(mc.Method, schemaRepository, OperationType.Publish), Subscribe = GenerateOperationFromMethod(mc.Method, schemaRepository, OperationType.Subscribe), }; channels.Add(mc.Channel.Name, channelItem); var context = new ChannelItemFilterContext(mc.Method, schemaRepository, mc.Channel); foreach (var filter in _options.ChannelItemFilters) { filter.Apply(channelItem, context); } } return(channels); }
private Message GenerateMessageFromAttribute(MessageAttribute messageAttribute, ISchemaRepository schemaRepository) { if (messageAttribute?.PayloadType == null) { return(null); } var message = new Message { Payload = _schemaGenerator.GenerateSchema(messageAttribute.PayloadType, schemaRepository), Name = messageAttribute.Name ?? _options.SchemaIdSelector(messageAttribute.PayloadType), Title = messageAttribute.Title, Summary = messageAttribute.Summary, Description = messageAttribute.Description, }; return(message); }
public IQueryable <SchemaVersion> GetVersions( [Parent] Schema schema, [Service] ISchemaRepository repository) => repository.GetSchemaVersions().Where(t => t.SchemaId == schema.Id);
/// <summary> /// Initializes a new instance of the <see cref="CreateAssetCommandHandler" /> class. /// </summary> /// <param name="schemaRepository">The schema repository.</param> /// <param name="eventBus">The event bus.</param> public CreateAssetCommandHandler(ISchemaRepository schemaRepository, IEventBus eventBus) { _schemaRepository = schemaRepository; _eventBus = eventBus; }
/// <summary> /// Initializes a new instance of the <see cref="CreateSchemaTaskEventCommandHandler"/> class. /// </summary> /// <param name="repository">The repository.</param> public CreateSchemaTaskEventCommandHandler(ISchemaRepository repository, IEventBus eventBus) { this._repository = repository; this._eventBus = eventBus; }
public Migrator(IDatabaseConnection dbConnection, MigratorOptions options) { DbConnection = dbConnection; SchemaRepository = new SchemaRepository(dbConnection); Options = options; }
public KnownTypeNamesVisitor(IGraphQLSchema schema) { this.schemaRepository = schema.SchemaRepository; this.Errors = new List <GraphQLException>(); }
internal ComplexIntrospectedType(ISchemaRepository schemaRepository, GraphQLComplexType type) { this.schemaRepository = schemaRepository; this.type = type; }
public SchemasCacheGrain(ISchemaRepository schemaRepository) { this.schemaRepository = schemaRepository; }
public DbScriptsService(ISchemaRepository schemaRepository) { _schemaRepository = schemaRepository ?? throw new ArgumentNullException(nameof(schemaRepository)); }
/// <summary> /// Initializes a new instance of the <see cref="CreateTaskTransitionCommandHandler" /> class. /// </summary> /// <param name="repository">The repository.</param> /// <param name="eventBus">The event bus.</param> public CreateTaskTransitionCommandHandler(ISchemaRepository repository, IEventBus eventBus) { _repository = repository; _eventBus = eventBus; }
public SchemasController(ISchemaRepository schemaRepository) { _schemaRepository = schemaRepository; }
public SchemaHandler(ISchemaRepository schemaRepository) { _schemaRepository = schemaRepository ?? throw new ArgumentNullException(nameof(schemaRepository)); }
public GraphQLBaseType GetGraphQLType(ISchemaRepository schemaRepository) { return(this.GetSchemaType(this.SystemType, schemaRepository)); }
private Message GenerateMessage(MethodInfo method, OperationAttribute operationAttribute, ISchemaRepository schemaRepository) { var message = new Message { Payload = _schemaGenerator.GenerateSchema(operationAttribute.MessagePayloadType, schemaRepository), // todo: all the other properties... message has a lot! }; return(message); }
public SchemasController(ICommandBus commandBus, ISchemaRepository schemaRepository) : base(commandBus) { this.schemaRepository = schemaRepository; }
public CreateSchemaEventCommandHandler(ISchemaRepository repository, IEventBus eventBus) { _repository = repository; _eventBus = eventBus; }
public Task <SchemaVersion?> GetSchemaVersionByExternalIdAsync( string externalId, [Service] ISchemaRepository repository, CancellationToken cancellationToken) => repository.GetSchemaVersionByExternalIdAsync(externalId, cancellationToken);
public abstract Result GetValueFromAst(GraphQLValue astValue, ISchemaRepository schemaRepository);
protected override GraphQLBaseType GetSchemaType(Type type, ISchemaRepository schemaRepository) { return(schemaRepository.GetSchemaTypeFor(type)); }
protected abstract GraphQLValue GetAst(object value, ISchemaRepository schemaRepository);