26 lines
		
	
	
		
			958 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			958 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.IO;
 | |
| using System.Reflection;
 | |
| using System.Threading;
 | |
| using Json.Schema;
 | |
| 
 | |
| namespace StellaOps.Concelier.Connector.Vndr.Chromium.Internal;
 | |
| 
 | |
| internal static class ChromiumSchemaProvider
 | |
| {
 | |
|     private static readonly Lazy<JsonSchema> Cached = new(Load, LazyThreadSafetyMode.ExecutionAndPublication);
 | |
| 
 | |
|     public static JsonSchema Schema => Cached.Value;
 | |
| 
 | |
|     private static JsonSchema Load()
 | |
|     {
 | |
|         var assembly = typeof(ChromiumSchemaProvider).GetTypeInfo().Assembly;
 | |
|         const string resourceName = "StellaOps.Concelier.Connector.Vndr.Chromium.Schemas.chromium-post.schema.json";
 | |
| 
 | |
|         using var stream = assembly.GetManifestResourceStream(resourceName)
 | |
|             ?? throw new InvalidOperationException($"Embedded schema '{resourceName}' not found.");
 | |
|         using var reader = new StreamReader(stream);
 | |
|         var schemaText = reader.ReadToEnd();
 | |
|         return JsonSchema.FromText(schemaText);
 | |
|     }
 | |
| }
 |