diff --git a/Aaru.Localization/UI.Designer.cs b/Aaru.Localization/UI.Designer.cs
index 897d8def3..5a95263b1 100644
--- a/Aaru.Localization/UI.Designer.cs
+++ b/Aaru.Localization/UI.Designer.cs
@@ -10859,5 +10859,35 @@ namespace Aaru.Localization {
return ResourceManager.GetString("Enables_calculation_of_Spamsum_fuzzy_hashes", resourceCulture);
}
}
+
+ public static string Output_is_required {
+ get {
+ return ResourceManager.GetString("Output_is_required", resourceCulture);
+ }
+ }
+
+ public static string Generating_JSON_schema_for_metadata {
+ get {
+ return ResourceManager.GetString("Generating_JSON_schema_for_metadata", resourceCulture);
+ }
+ }
+
+ public static string Schema_successfully_written_to_0 {
+ get {
+ return ResourceManager.GetString("Schema_successfully_written_to_0", resourceCulture);
+ }
+ }
+
+ public static string Output_file_for_the_JSON_schema {
+ get {
+ return ResourceManager.GetString("Output_file_for_the_JSON_schema", resourceCulture);
+ }
+ }
+
+ public static string Generates_the_JSON_schema_for_Aaru_metadata_files {
+ get {
+ return ResourceManager.GetString("Generates_the_JSON_schema_for_Aaru_metadata_files", resourceCulture);
+ }
+ }
}
}
diff --git a/Aaru.Localization/UI.es.resx b/Aaru.Localization/UI.es.resx
index 9dfae9361..61d2dd2ba 100644
--- a/Aaru.Localization/UI.es.resx
+++ b/Aaru.Localization/UI.es.resx
@@ -5425,4 +5425,19 @@ Probadores:
Activa calcular los hashes Spamsum.
+
+ [red]Se requiere una salida[/]
+
+
+ [slateblue1]Generadon esquema JSON para los metadatados…[/]
+
+
+ [slateblue1]Esquema escrito con éxito en {0}[/]
+
+
+ Fichero de salida para el esquema JSON
+
+
+ Genera el esquema JSON para los ficheros de metadatos Aaru
+
\ No newline at end of file
diff --git a/Aaru.Localization/UI.resx b/Aaru.Localization/UI.resx
index 5ae9ff51e..173626243 100644
--- a/Aaru.Localization/UI.resx
+++ b/Aaru.Localization/UI.resx
@@ -5509,4 +5509,19 @@ Do you want to continue?
Enables calculation of Spamsum fuzzy hashes.
+
+ [red]Output is required[/]
+
+
+ [slateblue1]Generating JSON schema for metadata…[/]
+
+
+ [slateblue1]Schema successfully written to {0}[/]
+
+
+ Output file for the JSON schema
+
+
+ Generates the JSON schema for Aaru metadata files
+
\ No newline at end of file
diff --git a/Aaru/Commands/MetadataSchema.cs b/Aaru/Commands/MetadataSchema.cs
new file mode 100644
index 000000000..9fc91a9ce
--- /dev/null
+++ b/Aaru/Commands/MetadataSchema.cs
@@ -0,0 +1,99 @@
+// /***************************************************************************
+// Aaru Data Preservation Suite
+// ----------------------------------------------------------------------------
+//
+// Filename : MetadataSchema.cs
+// Author(s) : Natalia Portillo
+//
+// Component : Commands.
+//
+// --[ Description ] ----------------------------------------------------------
+//
+// Implements the 'metadata-schema' command.
+//
+// --[ License ] --------------------------------------------------------------
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// ----------------------------------------------------------------------------
+// Copyright © 2011-2026 Natalia Portillo
+// ****************************************************************************/
+
+using System.Text.Json;
+using System.Text.Json.Nodes;
+using System.Text.Json.Schema;
+using System.Threading;
+using Aaru.CommonTypes;
+using Aaru.CommonTypes.AaruMetadata;
+using Aaru.CommonTypes.Enums;
+using Aaru.Core;
+using Aaru.Localization;
+using Aaru.Logging;
+using Spectre.Console.Cli;
+using IOFile = System.IO.File;
+
+namespace Aaru.Commands;
+
+sealed class MetadataSchemaCommand : Command
+{
+ const string MODULE_NAME = "Metadata Schema command";
+
+ public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
+ {
+ MainClass.PrintCopyright();
+
+ Statistics.AddCommand("metadata-schema");
+
+ AaruLogging.Debug(MODULE_NAME, "--debug={0}", settings.Debug);
+ AaruLogging.Debug(MODULE_NAME, "--verbose={0}", settings.Verbose);
+ AaruLogging.Debug(MODULE_NAME, "--output={0}", settings.Output);
+
+ if(string.IsNullOrWhiteSpace(settings.Output))
+ {
+ AaruLogging.Error(UI.Output_is_required);
+
+ return (int)ErrorNumber.InvalidArgument;
+ }
+
+ AaruLogging.WriteLine(UI.Generating_JSON_schema_for_metadata);
+
+ // Create options with the MetadataJsonContext as TypeInfoResolver
+ var options = new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ TypeInfoResolver = new MetadataJsonContext()
+ };
+
+ JsonNode schema = options.GetJsonSchemaAsNode(typeof(MetadataJson));
+
+ string jsonString = schema.ToJsonString(options);
+
+ IOFile.WriteAllText(settings.Output, jsonString);
+
+ AaruLogging.WriteLine(UI.Schema_successfully_written_to_0, settings.Output);
+
+ return (int)ErrorNumber.NoError;
+ }
+
+#region Nested type: Settings
+
+ public class Settings : BaseSettings
+ {
+ [CommandArgument(0, "