Пример #1
0
        public JsonSchema CreateContentSchema(Schema schema, JsonSchema dataSchema)
        {
            Guard.NotNull(schema, nameof(schema));
            Guard.NotNull(dataSchema, nameof(dataSchema));

            var schemaName = schema.Properties.Label.WithFallback(schema.Name);

            var contentSchema = new JsonSchema
            {
                Properties =
                {
                    ["id"]             = SchemaBuilder.GuidProperty($"The id of the {schemaName} content.",                                         true),
                    ["data"]           = SchemaBuilder.ObjectProperty(dataSchema,                                                                   $"The data of the {schemaName}.",       true),
                    ["dataDraft"]      = SchemaBuilder.ObjectProperty(dataSchema,                                                                   $"The draft data of the {schemaName}."),
                    ["version"]        = SchemaBuilder.NumberProperty($"The version of the {schemaName}.",                                          true),
                    ["created"]        = SchemaBuilder.DateTimeProperty($"The date and time when the {schemaName} content has been created.",       true),
                    ["createdBy"]      = SchemaBuilder.StringProperty($"The user that has created the {schemaName} content.",                       true),
                    ["lastModified"]   = SchemaBuilder.DateTimeProperty($"The date and time when the {schemaName} content has been modified last.", true),
                    ["lastModifiedBy"] = SchemaBuilder.StringProperty($"The user that has updated the {schemaName} content last.",                  true),
                    ["status"]         = SchemaBuilder.StringProperty($"The status of the content.",                                                true)
                },
                Type = JsonObjectType.Object
            };

            return(contentSchema);
        }