This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed
apimtemplate.test/Creator/TemplateCreatorTests Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ public async void ShouldCreateUnifiedAPITemplateResourceFromCreatorConfig()
139
139
Assert . Equal ( "swagger-link-json" , apiTemplateResource . properties . format ) ;
140
140
Assert . Equal ( api . openApiSpec , apiTemplateResource . properties . value ) ;
141
141
}
142
-
142
+ /*
143
143
[Fact]
144
144
public void ShouldCreateProtocolsFromOpenApiDocument()
145
145
{
@@ -161,5 +161,7 @@ public void ShouldCreateProtocolsFromOpenApiDocument()
161
161
// assert
162
162
Assert.Equal(count, protocols.Length);
163
163
}
164
+ */
164
165
}
166
+
165
167
}
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ public class APIConfig
46
46
public Dictionary < string , OperationsConfig > operations { get ; set ; }
47
47
public APITemplateAuthenticationSettings authenticationSettings { get ; set ; }
48
48
public string products { get ; set ; }
49
+ public string protocols { get ; set ; }
49
50
public DiagnosticConfig diagnostic { get ; set ; }
50
51
}
51
52
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ public async Task<APITemplateResource> CreateAPITemplateResourceAsync(APIConfig
116
116
apiTemplateResource . properties . path = api . suffix ;
117
117
apiTemplateResource . properties . isCurrent = api . isCurrent ;
118
118
apiTemplateResource . properties . displayName = api . name ;
119
- apiTemplateResource . properties . protocols = this . CreateProtocols ( doc ) ;
119
+ apiTemplateResource . properties . protocols = this . CreateProtocols ( api ) ;
120
120
// set the version set id
121
121
if ( api . apiVersionSetId != null )
122
122
{
@@ -146,15 +146,17 @@ public async Task<APITemplateResource> CreateAPITemplateResourceAsync(APIConfig
146
146
return apiTemplateResource ;
147
147
}
148
148
149
- public string [ ] CreateProtocols ( OpenApiDocument doc )
149
+ public string [ ] CreateProtocols ( APIConfig api )
150
150
{
151
- // pull protocols from swagger OpenApiDocument
152
- List < string > protocols = new List < string > ( ) ;
153
- foreach ( OpenApiServer server in doc . Servers )
154
- {
155
- protocols . Add ( server . Url . Split ( ":" ) [ 0 ] ) ;
151
+ string [ ] protocols ;
152
+
153
+ if ( api . protocols != null ) {
154
+ protocols = api . protocols . Split ( ", " ) ;
155
+ } else {
156
+ protocols = new string [ 1 ] { "https" } ;
156
157
}
157
- return protocols . ToArray ( ) ;
158
+
159
+ return protocols ;
158
160
}
159
161
160
162
public bool isSplitAPI ( APIConfig apiConfig )
You can’t perform that action at this time.
0 commit comments