public static async Task <SchemaDetailsDto> CreateSchemaAsync(ISchemasClient schemas, string appName, string name) { var schema = await schemas.PostSchemaAsync(appName, new CreateSchemaDto { Name = name, Fields = new List <UpsertSchemaFieldDto> { new UpsertSchemaFieldDto { Name = nameof(TestEntityData.Number).ToLowerInvariant(), Properties = new NumberFieldPropertiesDto { IsRequired = true } }, new UpsertSchemaFieldDto { Name = nameof(TestEntityData.String).ToLowerInvariant(), Properties = new StringFieldPropertiesDto { IsRequired = false } } }, IsPublished = true }); return(schema); }
public static async Task <SchemaDetailsDto> CreateSchemaAsync(ISchemasClient schemas, string appName, string name) { var schema = await schemas.PostSchemaAsync(appName, new CreateSchemaDto { Name = name, Fields = new List <UpsertSchemaFieldDto> { new UpsertSchemaFieldDto { Name = TestEntityData.NumberField, Properties = new NumberFieldPropertiesDto { IsRequired = true } }, new UpsertSchemaFieldDto { Name = TestEntityData.StringField, Properties = new StringFieldPropertiesDto { IsRequired = false } }, new UpsertSchemaFieldDto { Name = TestEntityData.GeoField, Properties = new GeolocationFieldPropertiesDto { IsRequired = false } }, new UpsertSchemaFieldDto { Name = TestEntityData.LocalizedField, Partitioning = "language", Properties = new StringFieldPropertiesDto { DefaultValue = "default" } } }, Scripts = new SchemaScriptsDto { Create = $@" if (ctx.data.{TestEntityData.NumberField}.iv === {ScriptTrigger}) {{ ctx.data.{TestEntityData.NumberField}.iv = incrementCounter('my'); replace(); }}" }, IsPublished = true }); return(schema); }
public static async Task <SchemaDetailsDto> CreateSchemaAsync(ISchemasClient schemas, string appName, string name) { var schema = await schemas.PostSchemaAsync(appName, new CreateSchemaDto { Name = name, Fields = new List <UpsertSchemaFieldDto> { new UpsertSchemaFieldDto { Name = TestEntityData.NumberField, Properties = new NumberFieldPropertiesDto { IsRequired = true } }, new UpsertSchemaFieldDto { Name = TestEntityData.StringField, Properties = new StringFieldPropertiesDto { IsRequired = false } } }, Scripts = new SchemaScriptsDto { Create = $@" if (ctx.data.{TestEntityData.NumberField}.iv === -99) {{ ctx.data.{TestEntityData.NumberField}.iv = incrementCounter('my'); replace(); }}" }, IsPublished = true }); return(schema); }
public ManagementTests() { schemasClient = TestClient.ClientManager.CreateSchemasClient(); }
public static async Task <SchemaDto> CreateSchemaAsync(ISchemasClient schemas, string appName, string name, SchemaScriptsDto scripts = null) { var schema = await schemas.PostSchemaAsync(appName, new CreateSchemaDto { Name = name, Fields = new List <UpsertSchemaFieldDto> { new UpsertSchemaFieldDto { Name = TestEntityData.NumberField, Properties = new NumberFieldPropertiesDto { IsRequired = true } }, new UpsertSchemaFieldDto { Name = TestEntityData.StringField, Properties = new StringFieldPropertiesDto { IsRequired = false } }, new UpsertSchemaFieldDto { Name = TestEntityData.GeoField, Properties = new GeolocationFieldPropertiesDto { IsRequired = false } }, new UpsertSchemaFieldDto { Name = TestEntityData.JsonField, Properties = new JsonFieldPropertiesDto { IsRequired = false } }, new UpsertSchemaFieldDto { Name = TestEntityData.LocalizedField, Partitioning = "language", Properties = new StringFieldPropertiesDto { DefaultValue = "default" } }, new UpsertSchemaFieldDto { Name = TestEntityData.IdField, Properties = new StringFieldPropertiesDto { IsRequired = false } } }, Scripts = scripts, IsPublished = true }); return(schema); }