Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 0199c67

Browse files
committed
refactor, fix sequence error
1 parent 0cb112f commit 0199c67

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/APIM_ARMTemplate/apimtemplate/Commands/Create.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ public CreateCommand()
2424
CommandOption apiVersion = this.Option("--apiVersion <apiVersion>", "API version", CommandOptionType.SingleValue);
2525
CommandOption apiVersionSetId = this.Option("--apiVersionSetId <apiVersionSetId>", "API version set id", CommandOptionType.SingleValue);
2626
CommandOption productIds = this.Option("--productIds <productIds>", "Product ids to associate the API with", CommandOptionType.MultipleValue);
27-
28-
// convert command options to CLIArguments class
29-
CLICreatorArguments cliArguments = new CLICreatorArguments()
30-
{
31-
openAPISpecFile = openAPISpecFile.Value(),
32-
openAPISpecURL = openAPISpecURL.Value(),
33-
outputLocation = outputLocation.Value(),
34-
xmlPolicyFile = xmlPolicyFile.Value(),
35-
xmlPolicyURL = xmlPolicyURL.Value(),
36-
linked = linked.HasValue(),
37-
path = path.Value(),
38-
apiRevision = apiRevision.Value(),
39-
apiVersion = apiVersion.Value(),
40-
apiVersionSetId = apiVersionSetId.Value(),
41-
productIds = productIds.Values
42-
};
4327

4428
this.HelpOption();
4529

@@ -53,6 +37,22 @@ public CreateCommand()
5337
APITemplateCreator apiTemplateCreator = new APITemplateCreator();
5438
TagTemplateCreator tagTemplateCreator = new TagTemplateCreator();
5539

40+
// convert command options to CLIArguments class
41+
CLICreatorArguments cliArguments = new CLICreatorArguments()
42+
{
43+
openAPISpecFile = openAPISpecFile.Value(),
44+
openAPISpecURL = openAPISpecURL.Value(),
45+
outputLocation = outputLocation.Value(),
46+
xmlPolicyFile = xmlPolicyFile.Value(),
47+
xmlPolicyURL = xmlPolicyURL.Value(),
48+
linked = linked.HasValue(),
49+
path = path.Value(),
50+
apiRevision = apiRevision.Value(),
51+
apiVersion = apiVersion.Value(),
52+
apiVersionSetId = apiVersionSetId.Value(),
53+
productIds = productIds.Values
54+
};
55+
5656
// create OpenApiDocument
5757
OpenApiDocument doc = new OpenApiDocument();
5858
if (cliArguments.openAPISpecFile != null)

src/APIM_ARMTemplate/apimtemplate/TemplateCreators/OperationTemplateCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public string CreateParameterDefaultValue(OpenApiParameterHeaderIntersection par
144144
}
145145
else if (parameter.Examples != null)
146146
{
147-
return JsonConvert.SerializeObject(parameter.Examples.First().Value);
147+
return JsonConvert.SerializeObject(parameter.Examples.SingleOrDefault().Value);
148148
}
149149
else
150150
{

0 commit comments

Comments
 (0)