Skip to content

Commit 2ea746f

Browse files
committed
Add metadata needed for tooling of service reference features
- #10789
1 parent 396c54d commit 2ea746f

File tree

4 files changed

+199
-0
lines changed

4 files changed

+199
-0
lines changed

src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
Condition="'$(OpenApiCodeDirectory)' == ''">$(BaseIntermediateOutputPath)</OpenApiCodeDirectory>
5858
</PropertyGroup>
5959

60+
<!--
61+
Well-known metadata of the code generator item groups.
62+
-->
63+
<ItemGroup>
64+
<AvailableItemName Include="OpenApiReference" />
65+
<AvailableItemName Include="OpenApiProjectReference" />
66+
</ItemGroup>
67+
6068
<!--
6169
Well-known metadata of the code generator item groups.
6270
-->

src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
</GenerateOpenApiCodeDependsOn>
1212
</PropertyGroup>
1313

14+
<ItemGroup>
15+
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)OpenApiItemsSchema.xaml">
16+
<Context>File;BrowseObject</Context>
17+
</PropertyPageSchema>
18+
</ItemGroup>
19+
1420
<!-- OpenApiProjectReference support. -->
1521

1622
<ItemGroup Condition=" '$(OpenApiBuildReferencedProjects)' == 'true' ">
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties">
2+
<ContentType Name="OpenApiReference"
3+
DisplayName="OpenApi file reference"
4+
ItemType="OpenApiReference" />
5+
6+
<ContentType Name="OpenApiProjectReference"
7+
DisplayName="OpenApi project reference"
8+
ItemType="OpenApiProjectReference" />
9+
10+
<ItemType Name="OpenApiReference"
11+
DisplayName="OpenApi File Reference" />
12+
13+
<ItemType Name="OpenApiProjectReference"
14+
DisplayName="OpenApi Project Reference" />
15+
16+
<Rule Name="OpenApiReference"
17+
DisplayName="File Properties"
18+
PageTemplate="generic"
19+
Description="File Properties"
20+
OverrideMode="Extend">
21+
<Rule.DataSource>
22+
<DataSource Persistence="ProjectFile" Label="Configuration" ItemType="OpenApiReference"
23+
HasConfigurationCondition="false" SourceOfDefaultValue="AfterContext" />
24+
</Rule.DataSource>
25+
26+
<Rule.Categories>
27+
<Category Name="Advanced" DisplayName="Advanced" />
28+
<Category Name="CodeGen" DisplayName="Code Generation" />
29+
<Category Name="Misc" DisplayName="Misc" />
30+
</Rule.Categories>
31+
32+
<DynamicEnumProperty Name="{}{ItemType}" DisplayName="Build Action" Category="Advanced"
33+
Description="How the file relates to the build and deployment processes."
34+
EnumProvider="ItemTypes" />
35+
36+
<StringProperty Name="Identity" Visible="false" ReadOnly="true">
37+
<StringProperty.DataSource>
38+
<DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
39+
PersistedName="Identity" SourceOfDefaultValue="AfterContext" />
40+
</StringProperty.DataSource>
41+
</StringProperty>
42+
43+
<StringProperty Name="FullPath"
44+
DisplayName="Full Path"
45+
ReadOnly="true"
46+
Category="Misc"
47+
Description="Location of the file.">
48+
<StringProperty.DataSource>
49+
<DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
50+
PersistedName="FullPath" SourceOfDefaultValue="AfterContext" />
51+
</StringProperty.DataSource>
52+
</StringProperty>
53+
54+
<StringProperty Name="FileNameAndExtension"
55+
DisplayName="File Name"
56+
ReadOnly="true"
57+
Category="Misc"
58+
Description="Name of the file.">
59+
<StringProperty.DataSource>
60+
<DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
61+
PersistedName="FileNameAndExtension" SourceOfDefaultValue="AfterContext" />
62+
</StringProperty.DataSource>
63+
</StringProperty>
64+
65+
<BoolProperty Name="Visible" Visible="false" Default="true" />
66+
67+
<StringProperty Name="DependentUpon" Visible="false">
68+
<StringProperty.Metadata>
69+
<NameValuePair Name="DoNotCopyAcrossProjects" Value="true" />
70+
</StringProperty.Metadata>
71+
</StringProperty>
72+
73+
<StringProperty Name="Link" Visible="false">
74+
<StringProperty.DataSource>
75+
<DataSource SourceOfDefaultValue="AfterContext" />
76+
</StringProperty.DataSource>
77+
<StringProperty.Metadata>
78+
<NameValuePair Name="DoNotCopyAcrossProjects" Value="true" />
79+
</StringProperty.Metadata>
80+
</StringProperty>
81+
82+
<StringProperty Name="ClassName" DisplayName="Class Name"
83+
Category="CodeGen"
84+
Description="Name of the generated class.">
85+
<StringProperty.DataSource>
86+
<DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
87+
PersistenceStyle="Attribute" />
88+
</StringProperty.DataSource>
89+
</StringProperty>
90+
91+
<StringProperty Name="Namespace" DisplayName="Namespace"
92+
Category="CodeGen"
93+
Description="Namespace to place the generated class in.">
94+
<StringProperty.DataSource>
95+
<DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
96+
PersistenceStyle="Attribute" />
97+
</StringProperty.DataSource>
98+
</StringProperty>
99+
100+
<StringProperty Name="Options" DisplayName="Generator options"
101+
Category="CodeGen"
102+
Description="Options to pass to the code generator.">
103+
<StringProperty.DataSource>
104+
<DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
105+
PersistenceStyle="Attribute" />
106+
</StringProperty.DataSource>
107+
</StringProperty>
108+
</Rule>
109+
110+
<Rule Name="OpenApiProjectReference"
111+
DisplayName="File Properties"
112+
PageTemplate="generic"
113+
Description="File Properties"
114+
OverrideMode="Extend">
115+
<Rule.DataSource>
116+
<DataSource Persistence="ProjectFile" Label="Configuration" ItemType="OpenApiProjectReference"
117+
HasConfigurationCondition="false" SourceOfDefaultValue="AfterContext" />
118+
</Rule.DataSource>
119+
120+
<Rule.Categories>
121+
<Category Name="Advanced" DisplayName="Advanced" />
122+
<Category Name="CodeGen" DisplayName="Code Generation" />
123+
<Category Name="Misc" DisplayName="Misc" />
124+
</Rule.Categories>
125+
126+
<DynamicEnumProperty Name="{}{ItemType}" DisplayName="Build Action" Category="Advanced"
127+
Description="How the file relates to the build and deployment processes."
128+
EnumProvider="ItemTypes" />
129+
130+
<StringProperty Name="Identity" Visible="false" ReadOnly="true">
131+
<StringProperty.DataSource>
132+
<DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
133+
PersistedName="Identity" SourceOfDefaultValue="AfterContext" />
134+
</StringProperty.DataSource>
135+
</StringProperty>
136+
137+
<StringProperty Name="FullPath"
138+
DisplayName="Full Path"
139+
ReadOnly="true"
140+
Category="Misc"
141+
Description="Location of the project file.">
142+
<StringProperty.DataSource>
143+
<DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
144+
PersistedName="FullPath" SourceOfDefaultValue="AfterContext" />
145+
</StringProperty.DataSource>
146+
</StringProperty>
147+
148+
<StringProperty Name="FileNameAndExtension"
149+
DisplayName="File Name"
150+
ReadOnly="true"
151+
Category="Misc"
152+
Description="Name of the project file.">
153+
<StringProperty.DataSource>
154+
<DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
155+
PersistedName="FileNameAndExtension" SourceOfDefaultValue="AfterContext" />
156+
</StringProperty.DataSource>
157+
</StringProperty>
158+
159+
<BoolProperty Name="Visible" Visible="false" Default="true" />
160+
161+
<StringProperty Name="Namespace" DisplayName="Namespace"
162+
Category="CodeGen"
163+
Description="Namespace to place the generated classes in.">
164+
<StringProperty.DataSource>
165+
<DataSource ItemType="OpenApiProjectReference" SourceOfDefaultValue="AfterContext"
166+
PersistenceStyle="Attribute" />
167+
</StringProperty.DataSource>
168+
</StringProperty>
169+
170+
<StringProperty Name="Options" DisplayName="Generator options"
171+
Category="CodeGen"
172+
Description="Options to pass to the code generator.">
173+
<StringProperty.DataSource>
174+
<DataSource ItemType="OpenApiProjectReference" SourceOfDefaultValue="AfterContext"
175+
PersistenceStyle="Attribute" />
176+
</StringProperty.DataSource>
177+
</StringProperty>
178+
</Rule>
179+
</ProjectSchemaDefinitions>

src/Mvc/Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?xml version="1.0" encoding="utf-8" standalone="no"?>
22
<Project>
3+
<ItemGroup>
4+
<PropertyPageSchema Include="../build/OpenApiItemsSchema.xaml">
5+
<Context>File;BrowseObject</Context>
6+
</PropertyPageSchema>
7+
</ItemGroup>
8+
39
<Target Name="GenerateOpenApiCode">
410
<MSBuild Projects="$(MSBuildProjectFile)"
511
Targets="GenerateOpenApiCode"

0 commit comments

Comments
 (0)