1- using System . Text . Json . Nodes ;
21using ReQuesty . Builder . CodeDOM ;
32using ReQuesty . Builder . Extensions ;
43using ReQuesty . Builder . Lock ;
5- using Microsoft . OpenApi . ApiManifest ;
64using ReQuesty . Core ;
75
86namespace ReQuesty . Builder . Configuration ;
@@ -13,15 +11,6 @@ public static GenerationConfiguration DefaultConfiguration
1311 {
1412 get ;
1513 } = new ( ) ;
16- public bool ShouldGetApiManifest
17- {
18- get
19- {
20- return ( string . IsNullOrEmpty ( OpenAPIFilePath ) || OpenAPIFilePath . Equals ( DefaultConfiguration . OpenAPIFilePath , StringComparison . OrdinalIgnoreCase ) ) &&
21- ( ! string . IsNullOrEmpty ( ApiManifestPath ) || ! ApiManifestPath . Equals ( DefaultConfiguration . ApiManifestPath , StringComparison . OrdinalIgnoreCase ) ) &&
22- ( ApiManifestPath . StartsWith ( "http" , StringComparison . OrdinalIgnoreCase ) || File . Exists ( ApiManifestPath ) ) ;
23- }
24- }
2514 public bool SkipGeneration
2615 {
2716 get ; set ;
@@ -31,10 +20,6 @@ public ConsumerOperation? Operation
3120 get ; set ;
3221 }
3322 public string OpenAPIFilePath { get ; set ; } = "openapi.yaml" ;
34- public string ApiManifestPath { get ; set ; } = "apimanifest.json" ;
35- // Optional filename suffix to be used when generating multiple API plugins for the same OpenAPI file.
36- // Note: It can not be set from the outside, it is only used internally when generating the plugin manifest.
37- internal string FileNameSuffix { get ; set ; } = "" ;
3823
3924 public string OutputPath { get ; set ; } = "./output" ;
4025 public string ClientClassName { get ; set ; } = "ApiClient" ;
@@ -51,7 +36,6 @@ public string ModelsNamespaceName
5136 get => $ "{ ClientNamespaceName } { NamespaceNameSeparator } { ModelsNamespaceSegmentName } ";
5237 }
5338 public GenerationLanguage Language { get ; set ; } = GenerationLanguage . CSharp ;
54- public HashSet < PluginType > PluginTypes { get ; set ; } = [ ] ;
5539 public string ? ApiRootUrl
5640 {
5741 get ; set ;
@@ -78,14 +62,6 @@ public HashSet<string> Deserializers
7862 "ReQuesty.Runtime.Serialization.Text.TextParseNodeFactory" ,
7963 "ReQuesty.Runtime.Serialization.Form.FormParseNodeFactory" ,
8064 } ;
81- public bool ShouldWriteBarrelsIfClassExists
82- {
83- get
84- {
85- return BarreledLanguagesWithConstantFileName . Contains ( Language ) ;
86- }
87- }
88- private static readonly HashSet < GenerationLanguage > BarreledLanguagesWithConstantFileName = [ ] ;
8965 public bool CleanOutput
9066 {
9167 get ; set ;
@@ -101,10 +77,6 @@ public StructuredMimeTypesCollection StructuredMimeTypes
10177 ] ;
10278 public HashSet < string > IncludePatterns { get ; set ; } = new ( 0 , StringComparer . OrdinalIgnoreCase ) ;
10379 public HashSet < string > ExcludePatterns { get ; set ; } = new ( 0 , StringComparer . OrdinalIgnoreCase ) ;
104- /// <summary>
105- /// The overrides loaded from the api manifest when refreshing a client, as opposed to the user provided ones.
106- /// </summary>
107- public HashSet < string > PatternsOverride { get ; set ; } = new ( 0 , StringComparer . OrdinalIgnoreCase ) ;
10880 public bool ClearCache
10981 {
11082 get ; set ;
@@ -115,13 +87,6 @@ public bool? IncludeReQuestyValidationRules
11587 get ; set ;
11688 }
11789
118- // If set to true, this allows to parse extensions from manifest
119- // to use in query operations for RPC requests
120- public bool ? IncludePluginExtensions
121- {
122- get ; set ;
123- }
124-
12590 public bool NoWorkspace
12691 {
12792 get ; set ;
@@ -150,13 +115,10 @@ public object Clone()
150115 ClearCache = ClearCache ,
151116 DisabledValidationRules = new ( DisabledValidationRules ?? Enumerable . Empty < string > ( ) , StringComparer . OrdinalIgnoreCase ) ,
152117 IncludeReQuestyValidationRules = IncludeReQuestyValidationRules ,
153- IncludePluginExtensions = IncludePluginExtensions ,
154118 MaxDegreeOfParallelism = MaxDegreeOfParallelism ,
155119 SkipGeneration = SkipGeneration ,
156120 NoWorkspace = NoWorkspace ,
157121 Operation = Operation ,
158- PatternsOverride = new ( PatternsOverride ?? Enumerable . Empty < string > ( ) , StringComparer . OrdinalIgnoreCase ) ,
159- PluginTypes = new ( PluginTypes ?? Enumerable . Empty < PluginType > ( ) ) ,
160122 DisableSSLValidation = DisableSSLValidation ,
161123 ExportPublicApi = ExportPublicApi ,
162124 } ;
@@ -193,37 +155,6 @@ internal void UpdateConfigurationFromLanguagesInformation(LanguagesInformation l
193155 }
194156 public const string ReQuestyHashManifestExtensionKey = "x-requesty-hash" ;
195157 public const string ReQuestyVersionManifestExtensionKey = "x-requesty-version" ;
196- public ApiDependency ToApiDependency ( string configurationHash , Dictionary < string , HashSet < string > > templatesWithOperations , string targetDirectory )
197- {
198- ApiDependency dependency = new ( )
199- {
200- ApiDescriptionUrl = NormalizeDescriptionLocation ( targetDirectory ) ,
201- ApiDeploymentBaseUrl = ApiRootUrl ? . EndsWith ( '/' ) ?? false ? ApiRootUrl : $ "{ ApiRootUrl } /",
202- Extensions = [ ] ,
203- Requests = templatesWithOperations . SelectMany ( static x => x . Value . Select ( y => new RequestInfo { Method = y . ToUpperInvariant ( ) , UriTemplate = x . Key . DeSanitizeUrlTemplateParameter ( ) } ) ) . ToList ( ) ,
204- } ;
205-
206- if ( ! string . IsNullOrEmpty ( configurationHash ) )
207- {
208- dependency . Extensions . Add ( ReQuestyHashManifestExtensionKey , JsonValue . Create ( configurationHash ) ) ; // only include non empty value.
209- }
210- dependency . Extensions . Add ( ReQuestyVersionManifestExtensionKey , ReQuestyVersion . Current ( ) ) ;
211- return dependency ;
212- }
213- private string NormalizeDescriptionLocation ( string targetDirectory )
214- {
215- if ( ! string . IsNullOrEmpty ( OpenAPIFilePath ) &&
216- ! string . IsNullOrEmpty ( targetDirectory ) &&
217- ! OpenAPIFilePath . StartsWith ( "http" , StringComparison . OrdinalIgnoreCase ) &&
218- Path . IsPathRooted ( OpenAPIFilePath ) &&
219- Path . GetFullPath ( OpenAPIFilePath ) . StartsWith ( Path . GetFullPath ( targetDirectory ) , StringComparison . Ordinal ) )
220- {
221- return "./" + Path . GetRelativePath ( targetDirectory , OpenAPIFilePath ) . NormalizePathSeparators ( ) ;
222- }
223-
224- return OpenAPIFilePath ;
225- }
226- public bool IsPluginConfiguration => PluginTypes . Count != 0 ;
227158
228159 public bool DisableSSLValidation
229160 {
0 commit comments