From 7424eeace99aefd68d5418b4284ad4be77405bc7 Mon Sep 17 00:00:00 2001 From: Gino Canessa Date: Fri, 24 Apr 2026 15:18:24 -0500 Subject: [PATCH 01/72] WIP Draft - updating dependencies (Version Lock: Major) --- .../Fhir.CodeGen.Comparison.csproj | 14 ++++++------- .../Fhir.CodeGen.CrossVersionExporter.csproj | 6 +++--- .../Fhir.CodeGen.CrossVersionLoader.csproj | 2 +- .../Fhir.CodeGen.LangSQLite.csproj | 10 +++++----- .../Fhir.CodeGen.Lib.Tests.csproj | 8 ++++---- src/Fhir.CodeGen.Lib/Fhir.CodeGen.Lib.csproj | 14 ++++++------- .../Fhir.CodeGen.MappingLanguage.csproj | 2 +- .../Fhir.CodeGen.Packages.Tests.csproj | 10 +++++----- .../Fhir.CodeGen.Packages.csproj | 2 +- src/fhir-codegen/fhir-codegen.csproj | 20 +++++++++---------- 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/Fhir.CodeGen.Comparison/Fhir.CodeGen.Comparison.csproj b/src/Fhir.CodeGen.Comparison/Fhir.CodeGen.Comparison.csproj index c442a8063..a89a37430 100644 --- a/src/Fhir.CodeGen.Comparison/Fhir.CodeGen.Comparison.csproj +++ b/src/Fhir.CodeGen.Comparison/Fhir.CodeGen.Comparison.csproj @@ -27,8 +27,8 @@ - - + + - - - - + + + + - + diff --git a/src/Fhir.CodeGen.CrossVersionExporter/Fhir.CodeGen.CrossVersionExporter.csproj b/src/Fhir.CodeGen.CrossVersionExporter/Fhir.CodeGen.CrossVersionExporter.csproj index 82a460261..d52467354 100644 --- a/src/Fhir.CodeGen.CrossVersionExporter/Fhir.CodeGen.CrossVersionExporter.csproj +++ b/src/Fhir.CodeGen.CrossVersionExporter/Fhir.CodeGen.CrossVersionExporter.csproj @@ -9,10 +9,10 @@ - - + + - + diff --git a/src/Fhir.CodeGen.CrossVersionLoader/Fhir.CodeGen.CrossVersionLoader.csproj b/src/Fhir.CodeGen.CrossVersionLoader/Fhir.CodeGen.CrossVersionLoader.csproj index 8f2de0978..dd248a710 100644 --- a/src/Fhir.CodeGen.CrossVersionLoader/Fhir.CodeGen.CrossVersionLoader.csproj +++ b/src/Fhir.CodeGen.CrossVersionLoader/Fhir.CodeGen.CrossVersionLoader.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Fhir.CodeGen.LangSQLite/Fhir.CodeGen.LangSQLite.csproj b/src/Fhir.CodeGen.LangSQLite/Fhir.CodeGen.LangSQLite.csproj index f8ff8509c..dc9072d66 100644 --- a/src/Fhir.CodeGen.LangSQLite/Fhir.CodeGen.LangSQLite.csproj +++ b/src/Fhir.CodeGen.LangSQLite/Fhir.CodeGen.LangSQLite.csproj @@ -14,11 +14,11 @@ - - - - - + + + + + diff --git a/src/Fhir.CodeGen.Lib.Tests/Fhir.CodeGen.Lib.Tests.csproj b/src/Fhir.CodeGen.Lib.Tests/Fhir.CodeGen.Lib.Tests.csproj index 7715ef8ae..ced645e39 100644 --- a/src/Fhir.CodeGen.Lib.Tests/Fhir.CodeGen.Lib.Tests.csproj +++ b/src/Fhir.CodeGen.Lib.Tests/Fhir.CodeGen.Lib.Tests.csproj @@ -24,10 +24,10 @@ - - - - + + + + diff --git a/src/Fhir.CodeGen.Lib/Fhir.CodeGen.Lib.csproj b/src/Fhir.CodeGen.Lib/Fhir.CodeGen.Lib.csproj index 58ab6b7d9..817dea3b7 100644 --- a/src/Fhir.CodeGen.Lib/Fhir.CodeGen.Lib.csproj +++ b/src/Fhir.CodeGen.Lib/Fhir.CodeGen.Lib.csproj @@ -30,13 +30,13 @@ - - - - - - - + + + + + + + diff --git a/src/Fhir.CodeGen.MappingLanguage/Fhir.CodeGen.MappingLanguage.csproj b/src/Fhir.CodeGen.MappingLanguage/Fhir.CodeGen.MappingLanguage.csproj index 654a3a02c..613ec45d2 100644 --- a/src/Fhir.CodeGen.MappingLanguage/Fhir.CodeGen.MappingLanguage.csproj +++ b/src/Fhir.CodeGen.MappingLanguage/Fhir.CodeGen.MappingLanguage.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Fhir.CodeGen.Packages.Tests/Fhir.CodeGen.Packages.Tests.csproj b/src/Fhir.CodeGen.Packages.Tests/Fhir.CodeGen.Packages.Tests.csproj index 951e73b4f..8dc4f6fe3 100644 --- a/src/Fhir.CodeGen.Packages.Tests/Fhir.CodeGen.Packages.Tests.csproj +++ b/src/Fhir.CodeGen.Packages.Tests/Fhir.CodeGen.Packages.Tests.csproj @@ -28,11 +28,11 @@ - - - - - + + + + + diff --git a/src/Fhir.CodeGen.Packages/Fhir.CodeGen.Packages.csproj b/src/Fhir.CodeGen.Packages/Fhir.CodeGen.Packages.csproj index 4ce5ac8ab..c9532367f 100644 --- a/src/Fhir.CodeGen.Packages/Fhir.CodeGen.Packages.csproj +++ b/src/Fhir.CodeGen.Packages/Fhir.CodeGen.Packages.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/fhir-codegen/fhir-codegen.csproj b/src/fhir-codegen/fhir-codegen.csproj index 4353d412e..bcbcdddab 100644 --- a/src/fhir-codegen/fhir-codegen.csproj +++ b/src/fhir-codegen/fhir-codegen.csproj @@ -17,17 +17,17 @@ - - - - - - - - - + + + + + + + + + - + From 132e515d0e2ec636fddc859d62a08898c9322ffc Mon Sep 17 00:00:00 2001 From: Gino Canessa Date: Fri, 24 Apr 2026 15:25:02 -0500 Subject: [PATCH 02/72] refactor(cli): qualify ParseResult and rename IsRequired to Required Phase 1 of System.CommandLine 2.0 GA migration. Replace the obsolete fully-qualified System.CommandLine.Parsing.ParseResult with the new System.CommandLine.ParseResult location, and rename Option.IsRequired to its GA name Required. Build is not yet green; the remaining errors are confined to M6/M7 Option constructors and HasOption / GetValueForOption call sites which Phase 2 addresses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Fhir.CodeGen.Lib.Tests/ConfigTests.cs | 14 +- .../Configuration/ConfigCompare.cs | 16 +-- .../ConfigCrossVersionInteractive.cs | 12 +- .../Configuration/ConfigGenerate.cs | 16 +-- .../Configuration/ConfigRoot.cs | 42 +++--- .../Configuration/ConfigSql.cs | 8 +- .../Configuration/ConfigXVer.cs | 48 +++---- .../Configuration/ICodeGenConfig.cs | 4 +- .../Language/Cql/CqlOptions.cs | 6 +- .../Language/Firely/FirelyGenOptions.cs | 10 +- .../Language/Firely/FirelyNetIG.cs | 6 +- .../Language/Info/LangInfo.cs | 6 +- .../Language/OpenApi/OpenApiOptions.cs | 130 +++++++++--------- .../Language/Ruby/RubyOptions.cs | 6 +- .../Language/SQLite/ExportSQLiteOptions.cs | 8 +- .../Language/Shorthand/ShorthandOptions.cs | 4 +- src/Fhir.CodeGen.Lib/Language/TypeScript.cs | 10 +- src/fhir-codegen-shared/LaunchUtils.cs | 2 +- src/fhir-codegen/Program.cs | 10 +- 19 files changed, 179 insertions(+), 179 deletions(-) diff --git a/src/Fhir.CodeGen.Lib.Tests/ConfigTests.cs b/src/Fhir.CodeGen.Lib.Tests/ConfigTests.cs index ecc82e279..115b3a4b5 100644 --- a/src/Fhir.CodeGen.Lib.Tests/ConfigTests.cs +++ b/src/Fhir.CodeGen.Lib.Tests/ConfigTests.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Text; using Shouldly; using Fhir.CodeGen.Lib.Configuration; @@ -30,7 +30,7 @@ public void TestParseCliInt() string[] args = ["--max-expansion-size", "2"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); @@ -59,7 +59,7 @@ public void TestParseCliString() string[] args = ["--output-filename", "a.file"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); @@ -88,7 +88,7 @@ public void TestParseCliBool() string[] args = ["--use-official-registries"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); @@ -117,7 +117,7 @@ public void TestParseCliBoolTrue() string[] args = ["--use-official-registries", "true"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); @@ -147,7 +147,7 @@ public void TestParseCliBoolFalse() string[] args = ["--use-official-registries", "false"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); @@ -176,7 +176,7 @@ public void TestParseCliStringArray() string[] args = ["--additional-fhir-registry-urls", "http://a.co/", "--additional-fhir-registry-urls", "http://b.co"]; // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); ConfigRoot config = new(); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs index bda997d25..77bf1beae 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -28,7 +28,7 @@ public class ConfigCompare : ConfigRoot CliOption = new System.CommandLine.Option(["--compare", "--compare-package", "-c"], "Comparison package to load, either as directive ([name]#[version/literal]) or URL.") { Arity = System.CommandLine.ArgumentArity.OneOrMore, - IsRequired = false, + Required = false, }, }; @@ -46,7 +46,7 @@ public class ConfigCompare : ConfigRoot CliOption = new System.CommandLine.Option("--no-output", "Do not output the comparison result.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -63,7 +63,7 @@ public class ConfigCompare : ConfigRoot CliOption = new System.CommandLine.Option("--save-comparison-result", "Save the comparison result to a file.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -81,7 +81,7 @@ public class ConfigCompare : ConfigRoot CliOption = new System.CommandLine.Option("--map-source-path", "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -99,7 +99,7 @@ public class ConfigCompare : ConfigRoot CliOption = new System.CommandLine.Option("--map-destination-path", "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -129,7 +129,7 @@ public enum ComparisonMapSaveStyle CliOption = new System.CommandLine.Option("--map-save-style", "Style of saving the comparison maps.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -207,7 +207,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs index d2749614d..4594288ba 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -28,7 +28,7 @@ public class ConfigCrossVersionInteractive : ConfigRoot CliOption = new System.CommandLine.Option("--cross-version-directory", "Local path to the 'HL7/fhir-cross-version' repository clone.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -46,7 +46,7 @@ public class ConfigCrossVersionInteractive : ConfigRoot CliOption = new System.CommandLine.Option("--left-package-directive", "Directive for the left (source) package.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -64,7 +64,7 @@ public class ConfigCrossVersionInteractive : ConfigRoot CliOption = new System.CommandLine.Option("--right-package-directive", "Directive for the right (target) package.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -82,7 +82,7 @@ public class ConfigCrossVersionInteractive : ConfigRoot CliOption = new System.CommandLine.Option("--existing-comparison-path", "Path to existing comparison files.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -102,7 +102,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs index fe6be31f3..92bd706b6 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -30,7 +30,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option([ "--include-experimental", "--experimental" ], "If the output should include structures marked experimental.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -49,7 +49,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option("--fhir-server-url", "FHIR Server URL to pull a CapabilityStatement (or Conformance) from. Requires application/fhir+json.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -65,7 +65,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option("--smart-config-url", "URL to pull a .well-known/smart-configuration file from, if different from [base]/.well-known/smart-configuration. Requires application/json (per spec).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -84,7 +84,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option("--fhir-server-header", "FHIR Server headers to use when pulling a CapabilityStatement (or Conformance) from a FHIR server. Use = format.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -102,7 +102,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option("--resolve-server-canonicals", "If canonical URLs used in server Capability Statement should be resolved.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -120,7 +120,7 @@ public class ConfigGenerate : ConfigRoot CliOption = new System.CommandLine.Option("--resolve-external-canonicals", "If canonical URLs external to the server should be resolved.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -153,7 +153,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs index f658b53db..206102a89 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -51,7 +51,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--fhir-cache", "Location of the FHIR cache (none specified defaults to user .fhir directory).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -69,7 +69,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--use-official-registries", "Use official FHIR registries to resolve packages.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -88,7 +88,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--additional-fhir-registry-urls", "Additional FHIR registry URLs to use.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -107,7 +107,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--additional-npm-registry-urls", "Additional NPM registry URLs to use.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -131,7 +131,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option(["--output-path", "--output-directory", "--output-dir"], "File or directory to write output.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -150,7 +150,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option(["--output-filename", "--output-file"], "Filename to write output.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -174,7 +174,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option(["--package", "--load-package", "-p"], "Package to load, either as directive ([name]#[version/literal]) or URL.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -192,7 +192,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--auto-load-expansions", "When loading core packages, load the expansions packages automatically.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -210,7 +210,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--resolve-dependencies", "Resolve package dependencies.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -227,7 +227,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--max-expansion-size", "Maximum number of concepts to include in a value set expansion before limiting.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -268,7 +268,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--load-structures", "Types of FHIR structures to load.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -306,7 +306,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--export-structures", "Types of FHIR structures to export.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -326,7 +326,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option>("--export-keys", "Keys of FHIR structures to export (e.g., Patient), empty means all.") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -345,7 +345,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--load-canonical-examples", "Load canonical examples from packages.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -369,7 +369,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--offline", "Offline mode (will not download missing packages).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -387,7 +387,7 @@ public class ConfigRoot : ICodeGenConfig CliOption = new System.CommandLine.Option("--fhir-version", "FHIR version to use.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -419,7 +419,7 @@ public class ConfigRoot : ICodeGenConfig public virtual ConfigurationOption[] GetOptions() => _options; internal T GetOpt( - System.CommandLine.Parsing.ParseResult parseResult, + System.CommandLine.ParseResult parseResult, ConfigurationOption opt, T defaultValue) { @@ -509,7 +509,7 @@ internal T GetOpt( } internal T[] GetOptArray( - System.CommandLine.Parsing.ParseResult parseResult, + System.CommandLine.ParseResult parseResult, ConfigurationOption opt, T[] defaultValue) { @@ -580,7 +580,7 @@ internal T[] GetOptArray( } internal HashSet GetOptHash( - System.CommandLine.Parsing.ParseResult parseResult, + System.CommandLine.ParseResult parseResult, System.CommandLine.Option opt, HashSet defaultValue) { @@ -636,7 +636,7 @@ internal HashSet GetOptHash( } /// Parses the given parse result. /// The parse result. - public virtual void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public virtual void Parse(System.CommandLine.ParseResult parseResult) { foreach (ConfigurationOption opt in _options) { diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs index b5eb7bd93..29b430017 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -27,7 +27,7 @@ public class ConfigSql : ConfigRoot CliOption = new System.CommandLine.Option("--view-definition-directory", "Local path to a source for view definitions to load.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -45,7 +45,7 @@ public class ConfigSql : ConfigRoot CliOption = new System.CommandLine.Option("--export-db-name", "Name of the database to generate.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -64,7 +64,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs index 2cbac4fab..6884db9d7 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -31,7 +31,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option(["--compare", "--compare-package", "-c"], "Comparison packages to load, as directives ([name][#|@][version/literal])") { Arity = System.CommandLine.ArgumentArity.OneOrMore, - IsRequired = false, + Required = false, }, }; @@ -50,7 +50,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--map-source-path", "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -70,7 +70,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--db", "Path or filename for the comparison database FHIR maps to load or export.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -89,7 +89,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--reload-db", "Set to force reloading of the comparison database from definitions.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -108,7 +108,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--source-db", "Fully specified filename for a source database to use for comparison processing.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -127,7 +127,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--comparison-pair-filter-key", "Set of Package Comparison Pair keys to process (used to reduce comparisons).") { Arity = System.CommandLine.ArgumentArity.ZeroOrMore, - IsRequired = false, + Required = false, }, }; @@ -146,7 +146,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r2", "Set to export DSTU2 artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -165,7 +165,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r3", "Set to export STU3 artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -184,7 +184,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r4", "Set to export R4 artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -203,7 +203,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r4b", "Set to export R4B artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -222,7 +222,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r5", "Set to export R5 artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -241,7 +241,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--export-r6", "Set to export R6 artifacts from the comparison database.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -260,7 +260,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-version", "The version number to use when exporting XVer artifacts.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -279,7 +279,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-generate-npms", "Set to generate NPMs for XVer artifacts.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -298,7 +298,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-generate-snapshots", "Set to generate snapshots for XVer artifacts.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -317,7 +317,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-allow-comparison-updates", "Whether or not to allow updates to the comparison database during processing.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -335,7 +335,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-export-for-publisher", "Set to export XVer artifacts for publisher.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -353,7 +353,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--xver-include-scripts", "Set to include scripts in the XVer artifacts.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -373,7 +373,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--no-output", "Do not output the comparison result.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -390,7 +390,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--save-comparison-result", "Save the comparison result to a file.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -409,7 +409,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--map-destination-path", "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -427,7 +427,7 @@ public class ConfigXVer : ConfigRoot CliOption = new System.CommandLine.Option("--use-internal-type-maps", "Set to use internal type maps for comparison processing.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -465,7 +465,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Configuration/ICodeGenConfig.cs b/src/Fhir.CodeGen.Lib/Configuration/ICodeGenConfig.cs index 2efb98969..702676e11 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ICodeGenConfig.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ICodeGenConfig.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -14,7 +14,7 @@ public interface ICodeGenConfig /// Parses the given parse result. /// The parse result. - void Parse(System.CommandLine.Parsing.ParseResult parseResult); + void Parse(System.CommandLine.ParseResult parseResult); /// Gets the initial command passed at launch. string? LaunchCommand { get; } diff --git a/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs b/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs index 6cf53ccd1..36f943a0b 100644 --- a/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -27,7 +27,7 @@ public class CqlOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--cql-support-dir", "Directory containing CQL support files (R5 ConceptMaps and Parameters).") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -45,7 +45,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs index 965132b8e..ca6ac57ff 100644 --- a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -27,7 +27,7 @@ public class FirelyGenOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--subset", "Which subset of language exports to make.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -46,7 +46,7 @@ public class FirelyGenOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--w5", "If the output should include 5W's mappings.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -63,7 +63,7 @@ public class FirelyGenOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--cql-model", "Name of the Cql model for which metadata attributes should be added to the pocos. 'Fhir401' is the only valid value at the moment.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -84,7 +84,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs index 0cd503cfb..ac40ffceb 100644 --- a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs +++ b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -238,7 +238,7 @@ public class FirelyNetIGOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--extension-accessors", "Style to export extension accessors with.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -252,7 +252,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs b/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs index 426b7e92e..b2fa17dfd 100644 --- a/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs +++ b/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -51,7 +51,7 @@ public class InfoOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--format", "File format to export.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -69,7 +69,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs b/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs index 66cafd672..28d56cf6e 100644 --- a/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -26,7 +26,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--oas-version", "Open API version to export as.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -43,7 +43,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--format", "File format to export.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -59,7 +59,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--title", "Title to use in Info section, defaults to 'FHIR [FhirSequence].[VersionString]'.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -72,7 +72,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--basic-scopes-only", "If only basic scopes should be included.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -88,7 +88,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--definition-version", "Version number to use in the OpenAPI file, defaults to '[FHIR Version]'") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -105,7 +105,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--extension-support", "The level of extensions to include.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -122,7 +122,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--schema-level", "The level of detail to include in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -139,7 +139,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--schema-style", "The style of schema to use.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -156,7 +156,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--max-recursions", "The maximum depth to expand recursions.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -173,7 +173,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--fhir-mime-types", "Which FHIR MIME types to support.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -190,7 +190,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--patch-mime-types", "Which FHIR Patch MIME types to support.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -207,7 +207,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--search-support", "Which HTTP methods to support in search.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -226,7 +226,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--export-search-params", "If search parameters should be included in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -243,7 +243,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--post-search-param-location", "Where to put search parameters in POST requests.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -262,7 +262,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--consolidate-search-parameters", "If search parameters should be consolidated.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -279,7 +279,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--operation-support", "Which HTTP methods to support in operations.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -296,7 +296,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--update-create", "If update can commit to a new identity.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -312,7 +312,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--conditional-read", "Override the capability statement conditional read support.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -329,7 +329,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--read", "If the read interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -346,7 +346,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--vread", "If the version-read interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -363,7 +363,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--update", "If the update interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -380,7 +380,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--update-conditional", "If the conditional update interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -397,7 +397,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--patch", "If the patch interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -414,7 +414,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--patch-conditional", "If the conditional patch interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -431,7 +431,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--delete", "If the delete interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -448,7 +448,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--delete-conditional-single", "If the conditional delete interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -465,7 +465,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--delete-conditional-multiple", "If the conditional delete interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -482,7 +482,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--delete-history", "If the delete history interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -500,7 +500,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--delete-history-version", "If the delete history version interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -518,7 +518,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--history-instance-read", "If history instance read is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -535,7 +535,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--history-type", "If history for a resource type is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -551,7 +551,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--history-system", "If history for a system is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -568,7 +568,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--create", "If the create interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -585,7 +585,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--create-conditional", "If the conditional create interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -602,7 +602,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--search-type", "If the type search interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -618,7 +618,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--search-system", "If the system search interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -634,7 +634,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--search-compartment", "If the compartment search interaction is supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -650,7 +650,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--operation-system", "If system-level operation interactions are supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -666,7 +666,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--operation-type", "If type-level operation interactions are supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -682,7 +682,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--operation-instance", "If instance-level operation interactions are supported.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -699,7 +699,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--metadata", "If the metadata endpoint should be included in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -715,7 +715,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--batch", "If the batch endpoint should be included in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -731,7 +731,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--transaction", "If the transaction endpoint should be included in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -748,7 +748,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--bundle", "If the bundle endpoint should be included in the schema.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -767,7 +767,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--read-only", "If the export should only contain HTTP GET support.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -786,7 +786,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--write-only", "If the export should only contain HTTP POST, PUT, PATCH, and DELETE support.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -804,7 +804,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--descriptions", "If properties should include descriptions.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -821,7 +821,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--description-max-length", "The maximum length of a description.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -840,7 +840,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--description-validation", "If descriptions are required and should be validated.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -857,7 +857,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--expand-profiles", "If profiles should be expanded.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -874,7 +874,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--expand-references", "If references should be expanded.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -891,7 +891,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--minify", "If the output should be minified.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -908,7 +908,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--id-convention", "The naming convention to use for ids.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -925,7 +925,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--remove-uncommon", "If the generator should remove some uncommon fields.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -942,7 +942,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--single-responses", "If operations should only include a single response.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -961,7 +961,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--summaries", "If responses should include summaries.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -979,7 +979,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--include-headers", "If HTTP headers should be included.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -996,7 +996,7 @@ public class OpenApiOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--multi-file", "If the output should be split into multiple files.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1024,7 +1024,7 @@ public string HttpCommonParams CliOption = new System.CommandLine.Option("--http-common-params", "Comma-separated list of common parameters to include in HTTP requests.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1054,7 +1054,7 @@ public string HttpReadParams CliOption = new System.CommandLine.Option("--http-read-params", "Comma-separated list of common parameters to include in HTTP read requests.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1081,7 +1081,7 @@ public string SearchResultParams CliOption = new System.CommandLine.Option("--search-result-params", "Comma-separated list of common parameters to include in search results.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1108,7 +1108,7 @@ public string SearchCommonParams CliOption = new System.CommandLine.Option("--search-common-params", "Comma-separated list of common parameters to include in search.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1135,7 +1135,7 @@ public string HistoryParams CliOption = new System.CommandLine.Option("--history-params", "Comma-separated list of common parameters to include in history.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -1216,7 +1216,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs b/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs index 65654dbf4..cfaaa314a 100644 --- a/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -30,7 +30,7 @@ public class RubyOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--module", "Base module for Ruby files, default is 'FHIR'.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -50,7 +50,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs b/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs index 9dd5d5693..03d25801d 100644 --- a/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using Fhir.CodeGen.Lib.Configuration; @@ -20,7 +20,7 @@ public class ExportSQLiteOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--include-extended-structures", "If extended structures (e.g., profiles, extensions) should be included.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -36,7 +36,7 @@ public class ExportSQLiteOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--drop-tables", "If tables should be dropped before processing") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -50,7 +50,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/Shorthand/ShorthandOptions.cs b/src/Fhir.CodeGen.Lib/Language/Shorthand/ShorthandOptions.cs index 242f42ca1..60b0152b2 100644 --- a/src/Fhir.CodeGen.Lib/Language/Shorthand/ShorthandOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Shorthand/ShorthandOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -22,7 +22,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/Fhir.CodeGen.Lib/Language/TypeScript.cs b/src/Fhir.CodeGen.Lib/Language/TypeScript.cs index f4b40bd28..0ce45c890 100644 --- a/src/Fhir.CodeGen.Lib/Language/TypeScript.cs +++ b/src/Fhir.CodeGen.Lib/Language/TypeScript.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // @@ -42,7 +42,7 @@ public class TypeScriptOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--namespace", "Base namespace for TypeScript files, default is 'fhir{VersionNumber}', use '' (empty string) for none.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -59,7 +59,7 @@ public class TypeScriptOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--min-ts-version", "Minimum TypeScript version, use '' (empty string) for none.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -76,7 +76,7 @@ public class TypeScriptOptions : ConfigGenerate CliOption = new System.CommandLine.Option("--inline-enums", "If code elements with required bindings should have inlined enums.") { Arity = System.CommandLine.ArgumentArity.ZeroOrOne, - IsRequired = false, + Required = false, }, }; @@ -97,7 +97,7 @@ public override ConfigurationOption[] GetOptions() return [.. base.GetOptions(), .. _options]; } - public override void Parse(System.CommandLine.Parsing.ParseResult parseResult) + public override void Parse(System.CommandLine.ParseResult parseResult) { // parse base properties base.Parse(parseResult); diff --git a/src/fhir-codegen-shared/LaunchUtils.cs b/src/fhir-codegen-shared/LaunchUtils.cs index a2338e061..f3a191ce7 100644 --- a/src/fhir-codegen-shared/LaunchUtils.cs +++ b/src/fhir-codegen-shared/LaunchUtils.cs @@ -122,7 +122,7 @@ private record class LaunchCommandRecord /// An instance of representing the parsed configuration. /// internal static ICodeGenConfig ParseConfig( - ParseResult pr, + System.CommandLine.ParseResult pr, string command, string? subCommand, ILoggerFactory? loggerFactory = null) diff --git a/src/fhir-codegen/Program.cs b/src/fhir-codegen/Program.cs index b66ae93e9..be55adabd 100644 --- a/src/fhir-codegen/Program.cs +++ b/src/fhir-codegen/Program.cs @@ -63,7 +63,7 @@ public static async Task Main(string[] args) Parser parser = BuildParser(envConfig); // attempt a parse - ParseResult pr = parser.Parse(args); + System.CommandLine.ParseResult pr = parser.Parse(args); string command; string? subCommand; @@ -115,7 +115,7 @@ public static async Task Main(string[] args) }; } - public static async Task DoGenerate(ParseResult pr, string command, string? subCommand) + public static async Task DoGenerate(System.CommandLine.ParseResult pr, string command, string? subCommand) { try { @@ -198,7 +198,7 @@ public static async Task DoGenerate(ParseResult pr, string command, string? return 0; } - public static async Task DoCompare(ParseResult pr, string command, string? subCommand) + public static async Task DoCompare(System.CommandLine.ParseResult pr, string command, string? subCommand) { try { @@ -261,7 +261,7 @@ public static async Task DoCompare(ParseResult pr, string command, string? return 0; } - public static Task DoXVer(ParseResult pr, string command, string? subCommand) + public static Task DoXVer(System.CommandLine.ParseResult pr, string command, string? subCommand) { try { @@ -290,7 +290,7 @@ public static Task DoXVer(ParseResult pr, string command, string? subComman } - public static async Task DoSql(ParseResult pr, string command, string? subCommand) + public static async Task DoSql(System.CommandLine.ParseResult pr, string command, string? subCommand) { try { From d0a9a469bea1a15a87b1dc7fe7db5762eb018969 Mon Sep 17 00:00:00 2001 From: Gino Canessa Date: Fri, 24 Apr 2026 15:46:56 -0500 Subject: [PATCH 03/72] refactor(cli): port Option constructors and ConfigRoot helpers to S.CL 2.0 GA Phase 2 of System.CommandLine 2.0 GA migration. Constructor migration (M6/M7): every 'new System.CommandLine.Option(...)' call site (~135 across Configuration/Config*.cs and Language/**/*Options.cs) now uses the GA shape -- a single name plus optional 'params string[]' aliases, with the description hoisted into the object initializer as 'Description = ...'. ConfigRoot helper rewrite (M4 + D1 shortcut): GetOpt, GetOptArray and GetOptHash no longer call the removed HasOption/GetValueForOption APIs. Instead they use the GA 'parseResult.GetResult(option)' overload plus OptionResult.GetValueOrDefault(), gated on OptionResult.Implicit so user-supplied CLI values still beat factory defaults. The boxed object flows through the existing per-type coercion switch unchanged. The Token branch is retained as a defensive fallback even though OptionResult.GetValueOrDefault() never returns a Token in 2.0 GA. Deviation: adopted the D1(b) reflection-free shortcut (ConfigurationOption unchanged, no per-option lambdas) rather than D1(a) which would have required introducing factory methods at every option construction site. Documented in plan.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Configuration/ConfigCompare.cs | 18 +- .../ConfigCrossVersionInteractive.cs | 12 +- .../Configuration/ConfigGenerate.cs | 18 +- .../Configuration/ConfigRoot.cs | 60 ++++-- .../Configuration/ConfigSql.cs | 6 +- .../Configuration/ConfigXVer.cs | 66 ++++-- .../Language/Cql/CqlOptions.cs | 3 +- .../Language/Firely/FirelyGenOptions.cs | 9 +- .../Language/Firely/FirelyNetIG.cs | 3 +- .../Language/Info/LangInfo.cs | 3 +- .../Language/OpenApi/OpenApiOptions.cs | 189 ++++++++++++------ .../Language/Ruby/RubyOptions.cs | 3 +- .../Language/SQLite/ExportSQLiteOptions.cs | 6 +- src/Fhir.CodeGen.Lib/Language/TypeScript.cs | 9 +- 14 files changed, 269 insertions(+), 136 deletions(-) diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs index 77bf1beae..08fec710e 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigCompare.cs @@ -25,8 +25,9 @@ public class ConfigCompare : ConfigRoot { Name = "Compare_Package", DefaultValue = Array.Empty(), - CliOption = new System.CommandLine.Option(["--compare", "--compare-package", "-c"], "Comparison package to load, either as directive ([name]#[version/literal]) or URL.") + CliOption = new System.CommandLine.Option("--compare", "--compare-package", "-c") { + Description = "Comparison package to load, either as directive ([name]#[version/literal]) or URL.", Arity = System.CommandLine.ArgumentArity.OneOrMore, Required = false, }, @@ -43,8 +44,9 @@ public class ConfigCompare : ConfigRoot { Name = "No_Output", DefaultValue = false, - CliOption = new System.CommandLine.Option("--no-output", "Do not output the comparison result.") + CliOption = new System.CommandLine.Option("--no-output") { + Description = "Do not output the comparison result.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -60,8 +62,9 @@ public class ConfigCompare : ConfigRoot { Name = "Save_Comparison_Result", DefaultValue = false, - CliOption = new System.CommandLine.Option("--save-comparison-result", "Save the comparison result to a file.") + CliOption = new System.CommandLine.Option("--save-comparison-result") { + Description = "Save the comparison result to a file.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -78,8 +81,9 @@ public class ConfigCompare : ConfigRoot { Name = "Map_Source_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--map-source-path", "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).") + CliOption = new System.CommandLine.Option("--map-source-path") { + Description = "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -96,8 +100,9 @@ public class ConfigCompare : ConfigRoot { Name = "Map_Destination_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--map-destination-path", "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).") + CliOption = new System.CommandLine.Option("--map-destination-path") { + Description = "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -126,8 +131,9 @@ public enum ComparisonMapSaveStyle { Name = "Map_Save_Style", DefaultValue = ComparisonMapSaveStyle.Official, - CliOption = new System.CommandLine.Option("--map-save-style", "Style of saving the comparison maps.") + CliOption = new System.CommandLine.Option("--map-save-style") { + Description = "Style of saving the comparison maps.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs index 4594288ba..2ef073789 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigCrossVersionInteractive.cs @@ -25,8 +25,9 @@ public class ConfigCrossVersionInteractive : ConfigRoot { Name = "Cross_Version_Directory", DefaultValue = "git/fhir-cross-version", - CliOption = new System.CommandLine.Option("--cross-version-directory", "Local path to the 'HL7/fhir-cross-version' repository clone.") + CliOption = new System.CommandLine.Option("--cross-version-directory") { + Description = "Local path to the 'HL7/fhir-cross-version' repository clone.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -43,8 +44,9 @@ public class ConfigCrossVersionInteractive : ConfigRoot { Name = "Left_Package_Directive", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--left-package-directive", "Directive for the left (source) package.") + CliOption = new System.CommandLine.Option("--left-package-directive") { + Description = "Directive for the left (source) package.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -61,8 +63,9 @@ public class ConfigCrossVersionInteractive : ConfigRoot { Name = "Right_Package_Directive", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--right-package-directive", "Directive for the right (target) package.") + CliOption = new System.CommandLine.Option("--right-package-directive") { + Description = "Directive for the right (target) package.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -79,8 +82,9 @@ public class ConfigCrossVersionInteractive : ConfigRoot { Name = "Existing_Comparison_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--existing-comparison-path", "Path to existing comparison files.") + CliOption = new System.CommandLine.Option("--existing-comparison-path") { + Description = "Path to existing comparison files.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs index 92bd706b6..9dcb17499 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigGenerate.cs @@ -27,8 +27,9 @@ public class ConfigGenerate : ConfigRoot Name = "IncludeExperimental", EnvVarName = "Include_Experimental", DefaultValue = false, - CliOption = new System.CommandLine.Option([ "--include-experimental", "--experimental" ], "If the output should include structures marked experimental.") + CliOption = new System.CommandLine.Option("--include-experimental", "--experimental") { + Description = "If the output should include structures marked experimental.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -46,8 +47,9 @@ public class ConfigGenerate : ConfigRoot Name = "FhirServerUrl", EnvVarName = "Fhir_Server_Url", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--fhir-server-url", "FHIR Server URL to pull a CapabilityStatement (or Conformance) from. Requires application/fhir+json.") + CliOption = new System.CommandLine.Option("--fhir-server-url") { + Description = "FHIR Server URL to pull a CapabilityStatement (or Conformance) from. Requires application/fhir+json.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -62,8 +64,9 @@ public class ConfigGenerate : ConfigRoot Name = "SmartConfigUrl", EnvVarName = "Smart_Config_Url", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--smart-config-url", "URL to pull a .well-known/smart-configuration file from, if different from [base]/.well-known/smart-configuration. Requires application/json (per spec).") + CliOption = new System.CommandLine.Option("--smart-config-url") { + Description = "URL to pull a .well-known/smart-configuration file from, if different from [base]/.well-known/smart-configuration. Requires application/json (per spec).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -81,8 +84,9 @@ public class ConfigGenerate : ConfigRoot Name = "FhirServerHeader", EnvVarName = "Fhir_Server_Header", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--fhir-server-header", "FHIR Server headers to use when pulling a CapabilityStatement (or Conformance) from a FHIR server. Use = format.") + CliOption = new System.CommandLine.Option("--fhir-server-header") { + Description = "FHIR Server headers to use when pulling a CapabilityStatement (or Conformance) from a FHIR server. Use = format.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -99,8 +103,9 @@ public class ConfigGenerate : ConfigRoot Name = "ResolveServerCanonicals", EnvVarName = "Resolve_Server_Canonicals", DefaultValue = true, - CliOption = new System.CommandLine.Option("--resolve-server-canonicals", "If canonical URLs used in server Capability Statement should be resolved.") + CliOption = new System.CommandLine.Option("--resolve-server-canonicals") { + Description = "If canonical URLs used in server Capability Statement should be resolved.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -117,8 +122,9 @@ public class ConfigGenerate : ConfigRoot Name = "ResolveExternalCanonicals", EnvVarName = "Resolve_External_Canonicals", DefaultValue = false, - CliOption = new System.CommandLine.Option("--resolve-external-canonicals", "If canonical URLs external to the server should be resolved.") + CliOption = new System.CommandLine.Option("--resolve-external-canonicals") { + Description = "If canonical URLs external to the server should be resolved.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs index 206102a89..e864b579d 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigRoot.cs @@ -48,8 +48,9 @@ public class ConfigRoot : ICodeGenConfig Name = "FhirCache", EnvVarName = "Fhir_Cache", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--fhir-cache", "Location of the FHIR cache (none specified defaults to user .fhir directory).") + CliOption = new System.CommandLine.Option("--fhir-cache") { + Description = "Location of the FHIR cache (none specified defaults to user .fhir directory).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -66,8 +67,9 @@ public class ConfigRoot : ICodeGenConfig Name = "UseOfficialRegistries", EnvVarName = "Use_Official_Registries", DefaultValue = true, - CliOption = new System.CommandLine.Option("--use-official-registries", "Use official FHIR registries to resolve packages.") + CliOption = new System.CommandLine.Option("--use-official-registries") { + Description = "Use official FHIR registries to resolve packages.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -85,8 +87,9 @@ public class ConfigRoot : ICodeGenConfig Name = "AdditionalFhirRegistryUrls", EnvVarName = "Additional_FHIR_Registry_Urls", DefaultValue = Array.Empty(), - CliOption = new System.CommandLine.Option("--additional-fhir-registry-urls", "Additional FHIR registry URLs to use.") + CliOption = new System.CommandLine.Option("--additional-fhir-registry-urls") { + Description = "Additional FHIR registry URLs to use.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -104,8 +107,9 @@ public class ConfigRoot : ICodeGenConfig Name = "AdditionalNpmRegistryUrls", EnvVarName = "Additional_NPM_Registry_Urls", DefaultValue = Array.Empty(), - CliOption = new System.CommandLine.Option("--additional-npm-registry-urls", "Additional NPM registry URLs to use.") + CliOption = new System.CommandLine.Option("--additional-npm-registry-urls") { + Description = "Additional NPM registry URLs to use.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -128,8 +132,9 @@ public class ConfigRoot : ICodeGenConfig Name = "OutputPath", EnvVarName = "Output_Path", DefaultValue = ".", - CliOption = new System.CommandLine.Option(["--output-path", "--output-directory", "--output-dir"], "File or directory to write output.") + CliOption = new System.CommandLine.Option("--output-path", "--output-directory", "--output-dir") { + Description = "File or directory to write output.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -147,8 +152,9 @@ public class ConfigRoot : ICodeGenConfig Name = "OutputFilename", EnvVarName = "Output_Filename", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option(["--output-filename", "--output-file"], "Filename to write output.") + CliOption = new System.CommandLine.Option("--output-filename", "--output-file") { + Description = "Filename to write output.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -171,8 +177,9 @@ public class ConfigRoot : ICodeGenConfig { Name = "Packages", DefaultValue = Array.Empty(), - CliOption = new System.CommandLine.Option(["--package", "--load-package", "-p"], "Package to load, either as directive ([name]#[version/literal]) or URL.") + CliOption = new System.CommandLine.Option("--package", "--load-package", "-p") { + Description = "Package to load, either as directive ([name]#[version/literal]) or URL.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -189,8 +196,9 @@ public class ConfigRoot : ICodeGenConfig Name = "AutoLoadExpansions", EnvVarName = "Auto_Load_Expansions", DefaultValue = true, - CliOption = new System.CommandLine.Option("--auto-load-expansions", "When loading core packages, load the expansions packages automatically.") + CliOption = new System.CommandLine.Option("--auto-load-expansions") { + Description = "When loading core packages, load the expansions packages automatically.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -207,8 +215,9 @@ public class ConfigRoot : ICodeGenConfig Name = "ResolvePackageDependencies", EnvVarName = "Resolve_Dependencies", DefaultValue = false, - CliOption = new System.CommandLine.Option("--resolve-dependencies", "Resolve package dependencies.") + CliOption = new System.CommandLine.Option("--resolve-dependencies") { + Description = "Resolve package dependencies.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -224,8 +233,9 @@ public class ConfigRoot : ICodeGenConfig Name = "MaxExpansionSize", EnvVarName = "Max_Expansion_Size", DefaultValue = DefaultMaxExpansionSize, - CliOption = new System.CommandLine.Option("--max-expansion-size", "Maximum number of concepts to include in a value set expansion before limiting.") + CliOption = new System.CommandLine.Option("--max-expansion-size") { + Description = "Maximum number of concepts to include in a value set expansion before limiting.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -265,8 +275,9 @@ public class ConfigRoot : ICodeGenConfig Name = "LoadStructures", EnvVarName = "Load_Structures", DefaultValue = _defaultLoadStructures, - CliOption = new System.CommandLine.Option("--load-structures", "Types of FHIR structures to load.") + CliOption = new System.CommandLine.Option("--load-structures") { + Description = "Types of FHIR structures to load.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -303,8 +314,9 @@ public class ConfigRoot : ICodeGenConfig Name = "ExportStructures", EnvVarName = "Export_Structures", DefaultValue = _defaultExportStructures, - CliOption = new System.CommandLine.Option("--export-structures", "Types of FHIR structures to export.") + CliOption = new System.CommandLine.Option("--export-structures") { + Description = "Types of FHIR structures to export.", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -342,8 +354,9 @@ public class ConfigRoot : ICodeGenConfig Name = "LoadCanonicalExamples", EnvVarName = "Load_Canonical_Examples", DefaultValue = false, - CliOption = new System.CommandLine.Option("--load-canonical-examples", "Load canonical examples from packages.") + CliOption = new System.CommandLine.Option("--load-canonical-examples") { + Description = "Load canonical examples from packages.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -366,8 +379,9 @@ public class ConfigRoot : ICodeGenConfig Name = "OfflineMode", EnvVarName = "Offline", DefaultValue = false, - CliOption = new System.CommandLine.Option("--offline", "Offline mode (will not download missing packages).") + CliOption = new System.CommandLine.Option("--offline") { + Description = "Offline mode (will not download missing packages).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -384,8 +398,9 @@ public class ConfigRoot : ICodeGenConfig Name = "FhirVersion", EnvVarName = "Fhir_Version", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--fhir-version", "FHIR version to use.") + CliOption = new System.CommandLine.Option("--fhir-version") { + Description = "FHIR version to use.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -423,12 +438,13 @@ internal T GetOpt( ConfigurationOption opt, T defaultValue) { - if (!parseResult.HasOption(opt.CliOption)) + System.CommandLine.Parsing.OptionResult? optResult = parseResult.GetResult(opt.CliOption); + if (optResult is null || optResult.Implicit) { return defaultValue; } - object? parsed = parseResult.GetValueForOption(opt.CliOption); + object? parsed = optResult.GetValueOrDefault(); if (typeof(T).IsEnum == true) { @@ -513,12 +529,13 @@ internal T[] GetOptArray( ConfigurationOption opt, T[] defaultValue) { - if (!parseResult.HasOption(opt.CliOption)) + System.CommandLine.Parsing.OptionResult? optResult = parseResult.GetResult(opt.CliOption); + if (optResult is null || optResult.Implicit) { return defaultValue; } - object? parsed = parseResult.GetValueForOption(opt.CliOption); + object? parsed = optResult.GetValueOrDefault(); if (parsed != null) { @@ -584,12 +601,13 @@ internal HashSet GetOptHash( System.CommandLine.Option opt, HashSet defaultValue) { - if (!parseResult.HasOption(opt)) + System.CommandLine.Parsing.OptionResult? optResult = parseResult.GetResult(opt); + if (optResult is null || optResult.Implicit) { return defaultValue; } - object? parsed = parseResult.GetValueForOption(opt); + object? parsed = optResult.GetValueOrDefault(); if (parsed == null) { diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs index 29b430017..a8ebd504b 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigSql.cs @@ -24,8 +24,9 @@ public class ConfigSql : ConfigRoot { Name = "View_Definition_Directory", DefaultValue = "", - CliOption = new System.CommandLine.Option("--view-definition-directory", "Local path to a source for view definitions to load.") + CliOption = new System.CommandLine.Option("--view-definition-directory") { + Description = "Local path to a source for view definitions to load.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -42,8 +43,9 @@ public class ConfigSql : ConfigRoot { Name = "Export_Database_Name", DefaultValue = "export.sqlite", - CliOption = new System.CommandLine.Option("--export-db-name", "Name of the database to generate.") + CliOption = new System.CommandLine.Option("--export-db-name") { + Description = "Name of the database to generate.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs b/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs index 6884db9d7..1ed560eee 100644 --- a/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs +++ b/src/Fhir.CodeGen.Lib/Configuration/ConfigXVer.cs @@ -28,8 +28,9 @@ public class ConfigXVer : ConfigRoot Name = "Compare_Package", EnvVarName = "Compare_Package", DefaultValue = Array.Empty(), - CliOption = new System.CommandLine.Option(["--compare", "--compare-package", "-c"], "Comparison packages to load, as directives ([name][#|@][version/literal])") + CliOption = new System.CommandLine.Option("--compare", "--compare-package", "-c") { + Description = "Comparison packages to load, as directives ([name][#|@][version/literal])", Arity = System.CommandLine.ArgumentArity.OneOrMore, Required = false, }, @@ -47,8 +48,9 @@ public class ConfigXVer : ConfigRoot Name = "Map_Source_Path", EnvVarName = "Map_Source_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--map-source-path", "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).") + CliOption = new System.CommandLine.Option("--map-source-path") { + Description = "Path to FHIR maps to load (e.g., clone of HL7/fhir-cross-version).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -67,8 +69,9 @@ public class ConfigXVer : ConfigRoot Name = "Comparison_Database_Path", EnvVarName = "Comparison_Database_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--db", "Path or filename for the comparison database FHIR maps to load or export.") + CliOption = new System.CommandLine.Option("--db") { + Description = "Path or filename for the comparison database FHIR maps to load or export.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -86,8 +89,9 @@ public class ConfigXVer : ConfigRoot Name = "Reload_Comparison_Database", EnvVarName = "Reload_Comparison_Database", DefaultValue = false, - CliOption = new System.CommandLine.Option("--reload-db", "Set to force reloading of the comparison database from definitions.") + CliOption = new System.CommandLine.Option("--reload-db") { + Description = "Set to force reloading of the comparison database from definitions.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -105,8 +109,9 @@ public class ConfigXVer : ConfigRoot Name = "Comparison_Source_Database", EnvVarName = "Comparison_Source_Database", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--source-db", "Fully specified filename for a source database to use for comparison processing.") + CliOption = new System.CommandLine.Option("--source-db") { + Description = "Fully specified filename for a source database to use for comparison processing.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -124,8 +129,9 @@ public class ConfigXVer : ConfigRoot Name = "Comparison_Pair_Filter_Key", EnvVarName = "Comparison_Pair_Filter_Key", DefaultValue = new HashSet(), - CliOption = new System.CommandLine.Option("--comparison-pair-filter-key", "Set of Package Comparison Pair keys to process (used to reduce comparisons).") + CliOption = new System.CommandLine.Option("--comparison-pair-filter-key") { + Description = "Set of Package Comparison Pair keys to process (used to reduce comparisons).", Arity = System.CommandLine.ArgumentArity.ZeroOrMore, Required = false, }, @@ -143,8 +149,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R2", EnvVarName = "Export_R2", DefaultValue = false, - CliOption = new System.CommandLine.Option("--export-r2", "Set to export DSTU2 artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r2") { + Description = "Set to export DSTU2 artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -162,8 +169,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R3", EnvVarName = "Export_R3", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-r3", "Set to export STU3 artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r3") { + Description = "Set to export STU3 artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -181,8 +189,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R4", EnvVarName = "Export_R4", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-r4", "Set to export R4 artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r4") { + Description = "Set to export R4 artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -200,8 +209,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R4B", EnvVarName = "Export_R4B", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-r4b", "Set to export R4B artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r4b") { + Description = "Set to export R4B artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -219,8 +229,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R5", EnvVarName = "Export_R5", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-r5", "Set to export R5 artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r5") { + Description = "Set to export R5 artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -238,8 +249,9 @@ public class ConfigXVer : ConfigRoot Name = "Export_R6", EnvVarName = "Export_R6", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-r6", "Set to export R6 artifacts from the comparison database.") + CliOption = new System.CommandLine.Option("--export-r6") { + Description = "Set to export R6 artifacts from the comparison database.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -257,8 +269,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Artifact_Version", EnvVarName = "Xver_Artifact_Version", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--xver-version", "The version number to use when exporting XVer artifacts.") + CliOption = new System.CommandLine.Option("--xver-version") { + Description = "The version number to use when exporting XVer artifacts.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -276,8 +289,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Generate_Npms", EnvVarName = "Xver_Generate_Npms", DefaultValue = true, - CliOption = new System.CommandLine.Option("--xver-generate-npms", "Set to generate NPMs for XVer artifacts.") + CliOption = new System.CommandLine.Option("--xver-generate-npms") { + Description = "Set to generate NPMs for XVer artifacts.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -295,8 +309,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Generate_Snapshots", EnvVarName = "Xver_Generate_Snapshots", DefaultValue = false, - CliOption = new System.CommandLine.Option("--xver-generate-snapshots", "Set to generate snapshots for XVer artifacts.") + CliOption = new System.CommandLine.Option("--xver-generate-snapshots") { + Description = "Set to generate snapshots for XVer artifacts.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -314,8 +329,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Allow_Comparison_Updates", EnvVarName = "Xver_Allow_Comparison_Updates", DefaultValue = true, - CliOption = new System.CommandLine.Option("--xver-allow-comparison-updates", "Whether or not to allow updates to the comparison database during processing.") + CliOption = new System.CommandLine.Option("--xver-allow-comparison-updates") { + Description = "Whether or not to allow updates to the comparison database during processing.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -332,8 +348,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Export_For_Publisher", EnvVarName = "Xver_Export_For_Publisher", DefaultValue = false, - CliOption = new System.CommandLine.Option("--xver-export-for-publisher", "Set to export XVer artifacts for publisher.") + CliOption = new System.CommandLine.Option("--xver-export-for-publisher") { + Description = "Set to export XVer artifacts for publisher.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -350,8 +367,9 @@ public class ConfigXVer : ConfigRoot Name = "Xver_Include_Scripts", EnvVarName = "Xver_Include_Scripts", DefaultValue = true, - CliOption = new System.CommandLine.Option("--xver-include-scripts", "Set to include scripts in the XVer artifacts.") + CliOption = new System.CommandLine.Option("--xver-include-scripts") { + Description = "Set to include scripts in the XVer artifacts.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -370,8 +388,9 @@ public class ConfigXVer : ConfigRoot Name = "No_Output", EnvVarName = "No_Output", DefaultValue = false, - CliOption = new System.CommandLine.Option("--no-output", "Do not output the comparison result.") + CliOption = new System.CommandLine.Option("--no-output") { + Description = "Do not output the comparison result.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -387,8 +406,9 @@ public class ConfigXVer : ConfigRoot { Name = "Save_Comparison_Result", DefaultValue = false, - CliOption = new System.CommandLine.Option("--save-comparison-result", "Save the comparison result to a file.") + CliOption = new System.CommandLine.Option("--save-comparison-result") { + Description = "Save the comparison result to a file.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -406,8 +426,9 @@ public class ConfigXVer : ConfigRoot Name = "Map_Destination_Path", EnvVarName = "Map_Destination_Path", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--map-destination-path", "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).") + CliOption = new System.CommandLine.Option("--map-destination-path") { + Description = "Path to directory to save FHIR maps to (e.g., clone of HL7/fhir-cross-version).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -424,8 +445,9 @@ public class ConfigXVer : ConfigRoot Name = "Use_Internal_Type_Maps", EnvVarName = "Use_Internal_Type_Maps", DefaultValue = false, - CliOption = new System.CommandLine.Option("--use-internal-type-maps", "Set to use internal type maps for comparison processing.") + CliOption = new System.CommandLine.Option("--use-internal-type-maps") { + Description = "Set to use internal type maps for comparison processing.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs b/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs index 36f943a0b..0f75015b8 100644 --- a/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Cql/CqlOptions.cs @@ -24,8 +24,9 @@ public class CqlOptions : ConfigGenerate { Name = "CqlSupportDir", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--cql-support-dir", "Directory containing CQL support files (R5 ConceptMaps and Parameters).") + CliOption = new System.CommandLine.Option("--cql-support-dir") { + Description = "Directory containing CQL support files (R5 ConceptMaps and Parameters).", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs index ca6ac57ff..430aeb720 100644 --- a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyGenOptions.cs @@ -24,8 +24,9 @@ public class FirelyGenOptions : ConfigGenerate { Name = "Subset", DefaultValue = CSharpFirelyCommon.GenSubset.Satellite, - CliOption = new System.CommandLine.Option("--subset", "Which subset of language exports to make.") + CliOption = new System.CommandLine.Option("--subset") { + Description = "Which subset of language exports to make.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -43,8 +44,9 @@ public class FirelyGenOptions : ConfigGenerate { Name = "ExportFiveWs", DefaultValue = true, - CliOption = new System.CommandLine.Option("--w5", "If the output should include 5W's mappings.") + CliOption = new System.CommandLine.Option("--w5") { + Description = "If the output should include 5W's mappings.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -60,8 +62,9 @@ public class FirelyGenOptions : ConfigGenerate { Name = "CqlModel", DefaultValue = string.Empty, - CliOption = new System.CommandLine.Option("--cql-model", "Name of the Cql model for which metadata attributes should be added to the pocos. 'Fhir401' is the only valid value at the moment.") + CliOption = new System.CommandLine.Option("--cql-model") { + Description = "Name of the Cql model for which metadata attributes should be added to the pocos. 'Fhir401' is the only valid value at the moment.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs index ac40ffceb..87a130bce 100644 --- a/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs +++ b/src/Fhir.CodeGen.Lib/Language/Firely/FirelyNetIG.cs @@ -235,8 +235,9 @@ public class FirelyNetIGOptions : ConfigGenerate { Name = "ExtensionAccessorExport", DefaultValue = ExtensionAccessorExportCodes.RecordAccessors, - CliOption = new System.CommandLine.Option("--extension-accessors", "Style to export extension accessors with.") + CliOption = new System.CommandLine.Option("--extension-accessors") { + Description = "Style to export extension accessors with.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs b/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs index b2fa17dfd..d186a490b 100644 --- a/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs +++ b/src/Fhir.CodeGen.Lib/Language/Info/LangInfo.cs @@ -48,8 +48,9 @@ public class InfoOptions : ConfigGenerate { Name = "FileFormat", DefaultValue = LangInfo.InfoFormat.Text, - CliOption = new System.CommandLine.Option("--format", "File format to export.") + CliOption = new System.CommandLine.Option("--format") { + Description = "File format to export.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs b/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs index 28d56cf6e..edf13f587 100644 --- a/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/OpenApi/OpenApiOptions.cs @@ -23,8 +23,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "OasVersion", DefaultValue = OaVersion.v3, - CliOption = new System.CommandLine.Option("--oas-version", "Open API version to export as.") + CliOption = new System.CommandLine.Option("--oas-version") { + Description = "Open API version to export as.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -40,8 +41,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "FileFormat", DefaultValue = OaFileFormat.JSON, - CliOption = new System.CommandLine.Option("--format", "File format to export.") + CliOption = new System.CommandLine.Option("--format") { + Description = "File format to export.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -56,8 +58,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "Title", DefaultValue = "", - CliOption = new System.CommandLine.Option("--title", "Title to use in Info section, defaults to 'FHIR [FhirSequence].[VersionString]'.") + CliOption = new System.CommandLine.Option("--title") { + Description = "Title to use in Info section, defaults to 'FHIR [FhirSequence].[VersionString]'.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -69,8 +72,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "BasicScopesOnly", DefaultValue = false, - CliOption = new System.CommandLine.Option("--basic-scopes-only", "If only basic scopes should be included.") + CliOption = new System.CommandLine.Option("--basic-scopes-only") { + Description = "If only basic scopes should be included.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -85,8 +89,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "DefinitionVersion", DefaultValue = "", - CliOption = new System.CommandLine.Option("--definition-version", "Version number to use in the OpenAPI file, defaults to '[FHIR Version]'") + CliOption = new System.CommandLine.Option("--definition-version") { + Description = "Version number to use in the OpenAPI file, defaults to '[FHIR Version]'", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -102,8 +107,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExtensionSupport", DefaultValue = ExtensionSupportLevel.NonPrimitive, - CliOption = new System.CommandLine.Option("--extension-support", "The level of extensions to include.") + CliOption = new System.CommandLine.Option("--extension-support") { + Description = "The level of extensions to include.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -119,8 +125,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SchemaLevel", DefaultValue = OaSchemaLevelCodes.Names, - CliOption = new System.CommandLine.Option("--schema-level", "The level of detail to include in the schema.") + CliOption = new System.CommandLine.Option("--schema-level") { + Description = "The level of detail to include in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -136,8 +143,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SchemaStyle", DefaultValue = OaSchemaStyleCodes.TypeReferences, - CliOption = new System.CommandLine.Option("--schema-style", "The style of schema to use.") + CliOption = new System.CommandLine.Option("--schema-style") { + Description = "The style of schema to use.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -153,8 +161,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "MaxRecursions", DefaultValue = 0, - CliOption = new System.CommandLine.Option("--max-recursions", "The maximum depth to expand recursions.") + CliOption = new System.CommandLine.Option("--max-recursions") { + Description = "The maximum depth to expand recursions.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -170,8 +179,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "FhirMimeTypes", DefaultValue = OaFhirMimeCodes.Capabilities, - CliOption = new System.CommandLine.Option("--fhir-mime-types", "Which FHIR MIME types to support.") + CliOption = new System.CommandLine.Option("--fhir-mime-types") { + Description = "Which FHIR MIME types to support.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -187,8 +197,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "PatchMimeTypes", DefaultValue = OaPatchMimeCodes.Capabilities, - CliOption = new System.CommandLine.Option("--patch-mime-types", "Which FHIR Patch MIME types to support.") + CliOption = new System.CommandLine.Option("--patch-mime-types") { + Description = "Which FHIR Patch MIME types to support.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -204,8 +215,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SearchSupport", DefaultValue = OaHttpMethods.Both, - CliOption = new System.CommandLine.Option("--search-support", "Which HTTP methods to support in search.") + CliOption = new System.CommandLine.Option("--search-support") { + Description = "Which HTTP methods to support in search.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -223,8 +235,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExportSearchParams", DefaultValue = true, - CliOption = new System.CommandLine.Option("--export-search-params", "If search parameters should be included in the schema.") + CliOption = new System.CommandLine.Option("--export-search-params") { + Description = "If search parameters should be included in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -240,8 +253,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "PostSearchParamLocation", DefaultValue = OaSearchPostParameterLocationCodes.Body, - CliOption = new System.CommandLine.Option("--post-search-param-location", "Where to put search parameters in POST requests.") + CliOption = new System.CommandLine.Option("--post-search-param-location") { + Description = "Where to put search parameters in POST requests.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -259,8 +273,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ConsolidateSearchParameters", DefaultValue = true, - CliOption = new System.CommandLine.Option("--consolidate-search-parameters", "If search parameters should be consolidated.") + CliOption = new System.CommandLine.Option("--consolidate-search-parameters") { + Description = "If search parameters should be consolidated.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -276,8 +291,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "OperationSupport", DefaultValue = OaHttpMethods.Both, - CliOption = new System.CommandLine.Option("--operation-support", "Which HTTP methods to support in operations.") + CliOption = new System.CommandLine.Option("--operation-support") { + Description = "Which HTTP methods to support in operations.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -293,8 +309,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "UpdateCreate", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--update-create", "If update can commit to a new identity.") + CliOption = new System.CommandLine.Option("--update-create") { + Description = "If update can commit to a new identity.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -309,8 +326,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ConditionalRead", DefaultValue = null!, - CliOption = new System.CommandLine.Option("--conditional-read", "Override the capability statement conditional read support.") + CliOption = new System.CommandLine.Option("--conditional-read") { + Description = "Override the capability statement conditional read support.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -326,8 +344,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionRead", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--read", "If the read interaction is supported.") + CliOption = new System.CommandLine.Option("--read") { + Description = "If the read interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -343,8 +362,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionVRead", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--vread", "If the version-read interaction is supported.") + CliOption = new System.CommandLine.Option("--vread") { + Description = "If the version-read interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -360,8 +380,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionUpdate", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--update", "If the update interaction is supported.") + CliOption = new System.CommandLine.Option("--update") { + Description = "If the update interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -377,8 +398,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionUpdateConditional", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--update-conditional", "If the conditional update interaction is supported.") + CliOption = new System.CommandLine.Option("--update-conditional") { + Description = "If the conditional update interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -394,8 +416,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionPatch", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--patch", "If the patch interaction is supported.") + CliOption = new System.CommandLine.Option("--patch") { + Description = "If the patch interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -411,8 +434,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionPatchConditional", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--patch-conditional", "If the conditional patch interaction is supported.") + CliOption = new System.CommandLine.Option("--patch-conditional") { + Description = "If the conditional patch interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -428,8 +452,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionDelete", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--delete", "If the delete interaction is supported.") + CliOption = new System.CommandLine.Option("--delete") { + Description = "If the delete interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -445,8 +470,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionDeleteConditionalSingle", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--delete-conditional-single", "If the conditional delete interaction is supported.") + CliOption = new System.CommandLine.Option("--delete-conditional-single") { + Description = "If the conditional delete interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -462,8 +488,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionDeleteConditionalMultiple", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--delete-conditional-multiple", "If the conditional delete interaction is supported.") + CliOption = new System.CommandLine.Option("--delete-conditional-multiple") { + Description = "If the conditional delete interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -479,8 +506,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionDeleteHistory", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--delete-history", "If the delete history interaction is supported.") + CliOption = new System.CommandLine.Option("--delete-history") { + Description = "If the delete history interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -497,8 +525,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionDeleteHistoryVersion", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--delete-history-version", "If the delete history version interaction is supported.") + CliOption = new System.CommandLine.Option("--delete-history-version") { + Description = "If the delete history version interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -515,8 +544,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionHistoryInstance", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--history-instance-read", "If history instance read is supported.") + CliOption = new System.CommandLine.Option("--history-instance-read") { + Description = "If history instance read is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -532,8 +562,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionHistoryType", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--history-type", "If history for a resource type is supported.") + CliOption = new System.CommandLine.Option("--history-type") { + Description = "If history for a resource type is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -548,8 +579,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionHistorySystem", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--history-system", "If history for a system is supported.") + CliOption = new System.CommandLine.Option("--history-system") { + Description = "If history for a system is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -565,8 +597,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionCreate", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--create", "If the create interaction is supported.") + CliOption = new System.CommandLine.Option("--create") { + Description = "If the create interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -582,8 +615,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionCreateConditional", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--create-conditional", "If the conditional create interaction is supported.") + CliOption = new System.CommandLine.Option("--create-conditional") { + Description = "If the conditional create interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -599,8 +633,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionSearchType", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--search-type", "If the type search interaction is supported.") + CliOption = new System.CommandLine.Option("--search-type") { + Description = "If the type search interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -615,8 +650,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionSearchSystem", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--search-system", "If the system search interaction is supported.") + CliOption = new System.CommandLine.Option("--search-system") { + Description = "If the system search interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -631,8 +667,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionSearchCompartment", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--search-compartment", "If the compartment search interaction is supported.") + CliOption = new System.CommandLine.Option("--search-compartment") { + Description = "If the compartment search interaction is supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -647,8 +684,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionOperationSystem", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--operation-system", "If system-level operation interactions are supported.") + CliOption = new System.CommandLine.Option("--operation-system") { + Description = "If system-level operation interactions are supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -663,8 +701,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionOperationType", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--operation-type", "If type-level operation interactions are supported.") + CliOption = new System.CommandLine.Option("--operation-type") { + Description = "If type-level operation interactions are supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -679,8 +718,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "InteractionOperationInstance", DefaultValue = OaCapabilityBoolean.Capabilities, - CliOption = new System.CommandLine.Option("--operation-instance", "If instance-level operation interactions are supported.") + CliOption = new System.CommandLine.Option("--operation-instance") { + Description = "If instance-level operation interactions are supported.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -696,8 +736,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SupportMetadata", DefaultValue = true, - CliOption = new System.CommandLine.Option("--metadata", "If the metadata endpoint should be included in the schema.") + CliOption = new System.CommandLine.Option("--metadata") { + Description = "If the metadata endpoint should be included in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -712,8 +753,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SupportBatch", DefaultValue = true, - CliOption = new System.CommandLine.Option("--batch", "If the batch endpoint should be included in the schema.") + CliOption = new System.CommandLine.Option("--batch") { + Description = "If the batch endpoint should be included in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -728,8 +770,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SupportTransaction", DefaultValue = true, - CliOption = new System.CommandLine.Option("--transaction", "If the transaction endpoint should be included in the schema.") + CliOption = new System.CommandLine.Option("--transaction") { + Description = "If the transaction endpoint should be included in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -745,8 +788,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SupportBundle", DefaultValue = true, - CliOption = new System.CommandLine.Option("--bundle", "If the bundle endpoint should be included in the schema.") + CliOption = new System.CommandLine.Option("--bundle") { + Description = "If the bundle endpoint should be included in the schema.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -764,8 +808,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExportReadOnly", DefaultValue = false, - CliOption = new System.CommandLine.Option("--read-only", "If the export should only contain HTTP GET support.") + CliOption = new System.CommandLine.Option("--read-only") { + Description = "If the export should only contain HTTP GET support.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -783,8 +828,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExportWriteOnly", DefaultValue = false, - CliOption = new System.CommandLine.Option("--write-only", "If the export should only contain HTTP POST, PUT, PATCH, and DELETE support.") + CliOption = new System.CommandLine.Option("--write-only") { + Description = "If the export should only contain HTTP POST, PUT, PATCH, and DELETE support.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -801,8 +847,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "PropertyDescriptions", DefaultValue = true, - CliOption = new System.CommandLine.Option("--descriptions", "If properties should include descriptions.") + CliOption = new System.CommandLine.Option("--descriptions") { + Description = "If properties should include descriptions.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -818,8 +865,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "DescriptionMaxLength", DefaultValue = 60, - CliOption = new System.CommandLine.Option("--description-max-length", "The maximum length of a description.") + CliOption = new System.CommandLine.Option("--description-max-length") { + Description = "The maximum length of a description.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -837,8 +885,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "PerformDescriptionValidation", DefaultValue = false, - CliOption = new System.CommandLine.Option("--description-validation", "If descriptions are required and should be validated.") + CliOption = new System.CommandLine.Option("--description-validation") { + Description = "If descriptions are required and should be validated.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -854,8 +903,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExpandProfiles", DefaultValue = true, - CliOption = new System.CommandLine.Option("--expand-profiles", "If profiles should be expanded.") + CliOption = new System.CommandLine.Option("--expand-profiles") { + Description = "If profiles should be expanded.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -871,8 +921,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "ExpandReferences", DefaultValue = true, - CliOption = new System.CommandLine.Option("--expand-references", "If references should be expanded.") + CliOption = new System.CommandLine.Option("--expand-references") { + Description = "If references should be expanded.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -888,8 +939,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "Minify", DefaultValue = false, - CliOption = new System.CommandLine.Option("--minify", "If the output should be minified.") + CliOption = new System.CommandLine.Option("--minify") { + Description = "If the output should be minified.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -905,8 +957,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "IdNamingConvention", DefaultValue = OaNamingConventionCodes.Pascal, - CliOption = new System.CommandLine.Option("--id-convention", "The naming convention to use for ids.") + CliOption = new System.CommandLine.Option("--id-convention") { + Description = "The naming convention to use for ids.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -922,8 +975,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "RemoveUncommonFields", DefaultValue = false, - CliOption = new System.CommandLine.Option("--remove-uncommon", "If the generator should remove some uncommon fields.") + CliOption = new System.CommandLine.Option("--remove-uncommon") { + Description = "If the generator should remove some uncommon fields.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -939,8 +993,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "SingleResponses", DefaultValue = false, - CliOption = new System.CommandLine.Option("--single-responses", "If operations should only include a single response.") + CliOption = new System.CommandLine.Option("--single-responses") { + Description = "If operations should only include a single response.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -958,8 +1013,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "IncludeSummaries", DefaultValue = true, - CliOption = new System.CommandLine.Option("--summaries", "If responses should include summaries.") + CliOption = new System.CommandLine.Option("--summaries") { + Description = "If responses should include summaries.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -976,8 +1032,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "IncludeHttpHeaders", DefaultValue = false, - CliOption = new System.CommandLine.Option("--include-headers", "If HTTP headers should be included.") + CliOption = new System.CommandLine.Option("--include-headers") { + Description = "If HTTP headers should be included.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -993,8 +1050,9 @@ public class OpenApiOptions : ConfigGenerate { Name = "MultiFile", DefaultValue = false, - CliOption = new System.CommandLine.Option("--multi-file", "If the output should be split into multiple files.") + CliOption = new System.CommandLine.Option("--multi-file") { + Description = "If the output should be split into multiple files.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -1021,8 +1079,9 @@ public string HttpCommonParams { Name = "HttpCommonParams", DefaultValue = string.Join(",", OpenApiCommon._httpCommonParameters.Keys), - CliOption = new System.CommandLine.Option("--http-common-params", "Comma-separated list of common parameters to include in HTTP requests.") + CliOption = new System.CommandLine.Option("--http-common-params") { + Description = "Comma-separated list of common parameters to include in HTTP requests.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -1051,8 +1110,9 @@ public string HttpReadParams { Name = "HttpReadParams", DefaultValue = string.Join(",", OpenApiCommon._httpReadParameters.Keys), - CliOption = new System.CommandLine.Option("--http-read-params", "Comma-separated list of common parameters to include in HTTP read requests.") + CliOption = new System.CommandLine.Option("--http-read-params") { + Description = "Comma-separated list of common parameters to include in HTTP read requests.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -1078,8 +1138,9 @@ public string SearchResultParams { Name = "SearchResultParams", DefaultValue = string.Join(",", OpenApiCommon._searchResultParameters.Keys), - CliOption = new System.CommandLine.Option("--search-result-params", "Comma-separated list of common parameters to include in search results.") + CliOption = new System.CommandLine.Option("--search-result-params") { + Description = "Comma-separated list of common parameters to include in search results.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -1105,8 +1166,9 @@ public string SearchCommonParams { Name = "SearchCommonParams", DefaultValue = string.Join(",", _searchCommonParameters.Keys), - CliOption = new System.CommandLine.Option("--search-common-params", "Comma-separated list of common parameters to include in search.") + CliOption = new System.CommandLine.Option("--search-common-params") { + Description = "Comma-separated list of common parameters to include in search.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -1132,8 +1194,9 @@ public string HistoryParams { Name = "HistoryParams", DefaultValue = string.Join(",", OpenApiCommon._historyParameters.Keys), - CliOption = new System.CommandLine.Option("--history-params", "Comma-separated list of common parameters to include in history.") + CliOption = new System.CommandLine.Option("--history-params") { + Description = "Comma-separated list of common parameters to include in history.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs b/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs index cfaaa314a..d47e56754 100644 --- a/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/Ruby/RubyOptions.cs @@ -27,8 +27,9 @@ public class RubyOptions : ConfigGenerate { Name = "Module", DefaultValue = DefaultModule, - CliOption = new System.CommandLine.Option("--module", "Base module for Ruby files, default is 'FHIR'.") + CliOption = new System.CommandLine.Option("--module") { + Description = "Base module for Ruby files, default is 'FHIR'.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs b/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs index 03d25801d..2dac0c9ef 100644 --- a/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs +++ b/src/Fhir.CodeGen.Lib/Language/SQLite/ExportSQLiteOptions.cs @@ -17,8 +17,9 @@ public class ExportSQLiteOptions : ConfigGenerate { Name = "IncludeExtendedStructures", DefaultValue = false, - CliOption = new System.CommandLine.Option("--include-extended-structures", "If extended structures (e.g., profiles, extensions) should be included.") + CliOption = new System.CommandLine.Option("--include-extended-structures") { + Description = "If extended structures (e.g., profiles, extensions) should be included.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -33,8 +34,9 @@ public class ExportSQLiteOptions : ConfigGenerate { Name = "DropTables", DefaultValue = false, - CliOption = new System.CommandLine.Option("--drop-tables", "If tables should be dropped before processing") + CliOption = new System.CommandLine.Option("--drop-tables") { + Description = "If tables should be dropped before processing", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, diff --git a/src/Fhir.CodeGen.Lib/Language/TypeScript.cs b/src/Fhir.CodeGen.Lib/Language/TypeScript.cs index 0ce45c890..ac98d2ef1 100644 --- a/src/Fhir.CodeGen.Lib/Language/TypeScript.cs +++ b/src/Fhir.CodeGen.Lib/Language/TypeScript.cs @@ -39,8 +39,9 @@ public class TypeScriptOptions : ConfigGenerate { Name = "Namespace", DefaultValue = DefaultNamespace, - CliOption = new System.CommandLine.Option("--namespace", "Base namespace for TypeScript files, default is 'fhir{VersionNumber}', use '' (empty string) for none.") + CliOption = new System.CommandLine.Option("--namespace") { + Description = "Base namespace for TypeScript files, default is 'fhir{VersionNumber}', use '' (empty string) for none.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -56,8 +57,9 @@ public class TypeScriptOptions : ConfigGenerate { Name = "MinTypeScriptVersion", DefaultValue = DefaultMinTsVersion, - CliOption = new System.CommandLine.Option("--min-ts-version", "Minimum TypeScript version, use '' (empty string) for none.") + CliOption = new System.CommandLine.Option("--min-ts-version") { + Description = "Minimum TypeScript version, use '' (empty string) for none.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, @@ -73,8 +75,9 @@ public class TypeScriptOptions : ConfigGenerate { Name = "InlineEnums", DefaultValue = true, - CliOption = new System.CommandLine.Option("--inline-enums", "If code elements with required bindings should have inlined enums.") + CliOption = new System.CommandLine.Option("--inline-enums") { + Description = "If code elements with required bindings should have inlined enums.", Arity = System.CommandLine.ArgumentArity.ZeroOrOne, Required = false, }, From 60829d411c301fe62d8df2c723c4b36d9966fe35 Mon Sep 17 00:00:00 2001 From: Gino Canessa Date: Mon, 27 Apr 2026 08:22:22 -0500 Subject: [PATCH 04/72] refactor(cli): migrate LaunchUtils parser pipeline to S.CL 2.0 GA Replace beta4 Parser/CommandLineBuilder/UseDefaults/UseHelp/UseExceptionHandler chain with the GA shape: BuildCli now returns (RootCommand, ParserConfiguration, InvocationConfiguration). Help customization is wired via a new EnumAwareHelpAction : SynchronousCommandLineAction that prints per-enum option detail before delegating to the stock HelpAction (HelpBuilder is internal in 2.0 so per-symbol column customization is unavailable; emit the enum block as preamble). AddGlobalOption/AddOption/AddCommand/AddAlias swapped for opt.Recursive + Options/Subcommands/Aliases.Add. SetDefaultValue/SetDefaultValueFactory removed (D1(b)); runtime defaults remain handled in ConfigRoot.GetOpt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/fhir-codegen-shared/LaunchUtils.cs | 203 +++++++++++++++++-------- 1 file changed, 139 insertions(+), 64 deletions(-) diff --git a/src/fhir-codegen-shared/LaunchUtils.cs b/src/fhir-codegen-shared/LaunchUtils.cs index f3a191ce7..788ac7b72 100644 --- a/src/fhir-codegen-shared/LaunchUtils.cs +++ b/src/fhir-codegen-shared/LaunchUtils.cs @@ -4,7 +4,6 @@ // using System.CommandLine; -using System.CommandLine.Builder; using System.CommandLine.Help; using System.CommandLine.Invocation; using System.CommandLine.Parsing; @@ -210,63 +209,141 @@ internal static ICodeGenConfig ParseConfig( return config; } - internal static Parser BuildParser(IConfiguration envConfig, RootCommand? rc = null) + /// + /// Builds the CLI surface for the application: returns the configured + /// together with the per-parser and per-invocation + /// configurations expected by System.CommandLine 2.0 GA. + /// + /// The environment configuration. + /// Optional pre-built root command (used by tests). + /// Tuple of root, parser configuration, invocation configuration. + internal static (RootCommand Root, ParserConfiguration ParserConfig, InvocationConfiguration InvocationConfig) BuildCli( + IConfiguration envConfig, + RootCommand? rc = null) { RootCommand command = rc ?? BuildCommand(envConfig); - Parser parser = new CommandLineBuilder(command) - .UseExceptionHandler((ex, ctx) => + // Replace the default help action with one that prepends per-enum option detail. + CustomizeRootHelp(command); + + ParserConfiguration parserConfig = new(); + InvocationConfiguration invocationConfig = new() + { + // We catch and report exceptions ourselves in Program.Main to match the + // beta4 UX (single-line "Error: ..." with exit code 1). + EnableDefaultExceptionHandler = false, + }; + + return (command, parserConfig, invocationConfig); + } + + /// + /// Replaces the help action on the root command's with an + /// that prints enum option detail before the + /// standard help layout. is recursive by default in + /// System.CommandLine 2.0 GA, so customizing the root suffices for subcommands. + /// + /// The root command to customize. + private static void CustomizeRootHelp(RootCommand root) + { + HelpOption? helpOpt = root.Options.OfType().FirstOrDefault(); + if (helpOpt != null) + { + helpOpt.Action = new EnumAwareHelpAction(_optsWithEnums); + } + } + + /// + /// Custom help action that prints a description block for every enum-typed option + /// (mirroring the beta4 UseHelp + HelpBuilder.CustomizeSymbol flow) + /// before delegating to the stock for the standard layout. + /// is internal in System.CommandLine 2.0 GA, so we cannot + /// per-symbol customize the column rendering directly; emitting the enum block as + /// preamble preserves the information content with a minor cosmetic shift. + /// + internal sealed class EnumAwareHelpAction : SynchronousCommandLineAction + { + private readonly List