public IActionResult Post([FromBody] JsonSchema schema)
        {
            if (schema is null)
            {
                return(BadRequest("HTTP POST operation must contain valide a JSON Schema."));
            }

            var result = schema.ValidateSchema();

            if (!result.IsValid)
            {
                return(BadRequest(result.MetaSchemaValidations));
            }
            if (!string.IsNullOrEmpty(schema.Id))
            {
                return(BadRequest("JSON Schema cannot contain 'id' or '$id' attribute."));
            }

            var schemaTitle = schema.Title().Kebaberize();

            schema.Id($"https://localhost:5001/api/schema/{schemaTitle}");

            var idPropSchema = new JsonSchema()
            {
                new TypeKeyword(JsonSchemaType.String),
                new DescriptionKeyword("Unique identifier assigned to this entity")
            };

            schema.Property("_id", idPropSchema);
            schema.Required("_id");

            store.Add(schemaTitle, schema);
            return(base.CreatedAtRoute("GetSchema", new { schemaName = schemaTitle }, schema));
        }
 public override JsonSchema AsJsonSchema()
 {
     if (TopPart != null)
     {
         JsonSchema returnSchema = TopPart.AsJsonSchema();
         returnSchema.Id(Name);
         returnSchema.Schema("http://json-schema.org/draft-07/schema#");
         foreach (var pair in Definitions)
         {
             returnSchema.Definition(pair.Key, pair.Value.AsJsonSchema());
         }
         return(returnSchema);
     }
     else
     {
         JsonSchema returnSchema = JsonSchema.Empty;
         returnSchema.Id(Name);
         returnSchema.Schema("http://json-schema.org/draft-07/schema#");
         returnSchema.Title(Name);
         returnSchema.Description(Description);
         return(returnSchema);
     }
 }