コード例 #1
0
        /// <summary>
        /// Given an entity and its matching json schema, generate links from templates defined in the schema
        /// using properties of the entity.
        /// </summary>
        /// <param name="schema">The schema json in string form</param>
        /// <param name="entity">The entity for which the utility generates links for</param>
        /// <returns></returns>
        public IEnumerable <Link> GetLinks(string schema, IHypermediaResource entity)
        {
            var parsedSchema = JsonSchema.Parse(schema);

            entity.Validate(parsedSchema, Serializer);
            var links = GetLinksFromSchema(schema);

            EnrichLinksWithData(entity, links);
            return(links);
        }
コード例 #2
0
 public void ItShouldBeValidWithPropertyAttributes()
 {
     Assert.DoesNotThrow(() => resource.Validate(personSchema));
 }