This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/APIM_ARMTemplate/apimtemplate Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ public class SchemaTemplateProperties
15
15
public class SchemaTemplateDocument
16
16
{
17
17
public string value { get ; set ; }
18
+
19
+ public dynamic components { get ; set ; }
18
20
}
19
21
20
22
public class RESTReturnedSchemaTemplate : APITemplateSubResource
Original file line number Diff line number Diff line change @@ -494,14 +494,21 @@ private async Task<List<TemplateResource>> GenerateSchemasARMTemplate(string api
494
494
495
495
private string GetSchemaValueBasedOnContentType ( RESTReturnedSchemaTemplateProperties schemaTemplateProperties )
496
496
{
497
+ var contentType = schemaTemplateProperties . contentType . ToLowerInvariant ( ) ;
498
+ if ( contentType . Equals ( "application/vnd.oai.openapi.components+json" ) )
499
+ {
500
+ // for OpenAPI "value" is not used, but "components" which is resolved during json deserialization
501
+ return null ;
502
+ }
503
+
497
504
if ( ! ( schemaTemplateProperties . document is JToken ) )
498
505
{
499
506
return JsonConvert . SerializeObject ( schemaTemplateProperties . document ) ;
500
507
}
501
508
502
509
var schemaJson = schemaTemplateProperties . document as JToken ;
503
510
504
- switch ( schemaTemplateProperties . contentType . ToLowerInvariant ( ) )
511
+ switch ( contentType )
505
512
{
506
513
case "application/vnd.ms-azure-apim.swagger.definitions+json" :
507
514
if ( schemaJson [ "definitions" ] != null && schemaJson . Count ( ) == 1 )
You can’t perform that action at this time.
0 commit comments