// Copyright Epic Games, Inc. All Rights Reserved.
using System;
namespace EpicGames.Core
{
///
/// Attribute setting the identifier for a schema
///
[AttributeUsage(AttributeTargets.Class)]
public sealed class JsonSchemaAttribute : Attribute
{
///
/// The schema identifier
///
public string Id { get; }
///
/// Constructor
///
///
public JsonSchemaAttribute(string id)
{
Id = id;
}
}
///
/// Attribute setting catalog entries for a schema
///
[AttributeUsage(AttributeTargets.Class)]
public sealed class JsonSchemaCatalogAttribute : Attribute
{
///
/// The schema name
///
public string Name { get; }
///
/// Description of the schema
///
public string Description { get; }
///
/// File patterns to match
///
public string[]? FileMatch { get; }
///
/// Constructor
///
///
///
/// File patterns to match
#pragma warning disable CA1019 // Define accessors for attribute arguments
public JsonSchemaCatalogAttribute(string name, string description, string? fileMatch)
#pragma warning restore CA1019 // Define accessors for attribute arguments
: this(name, description, (fileMatch == null) ? (string[]?)null : [fileMatch])
{
}
///
/// Constructor
///
///
///
/// File patterns to match
public JsonSchemaCatalogAttribute(string name, string description, string[]? fileMatch)
{
Name = name;
Description = description;
FileMatch = fileMatch;
}
}
///
/// Attribute setting properties for a type to be serialized as a string
///
public abstract class JsonSchemaTypeAttribute : Attribute
{
}
///
/// Attribute allowing any possible value in a json schema
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property)]
public sealed class JsonSchemaAnyAttribute : JsonSchemaTypeAttribute
{
}
///
/// Attribute setting properties for a type to be serialized as a string
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property)]
public sealed class JsonSchemaStringAttribute : JsonSchemaTypeAttribute
{
///
/// Format of the string
///
public JsonSchemaStringFormat? Format { get; set; }
}
}