Skip to content

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

ASimpleWeatherApi/ASimpleWeatherApi/ASimpleWeatherApi.csproj

+9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11+
<PackageReference Include="NSwag.AspNetCore" Version="14.0.7" />
12+
<PackageReference Include="NSwag.MSBuild" Version="14.0.7">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
1116
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1217
</ItemGroup>
1318

19+
<Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug' ">
20+
<Exec WorkingDirectory="$(ProjectDir)" EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="$(NSwagExe_Net80) run nswag.json /variables:Configuration=$(Configuration)" />
21+
</Target>
22+
1423
</Project>

ASimpleWeatherApi/ASimpleWeatherApi/Program.cs

+4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
builder.Services.AddEndpointsApiExplorer();
88
builder.Services.AddSwaggerGen();
99

10+
builder.Services.AddOpenApiDocument();
11+
1012
var app = builder.Build();
1113

1214
// Configure the HTTP request pipeline.
1315
if (app.Environment.IsDevelopment())
1416
{
17+
app.UseOpenApi();
18+
1519
app.UseSwagger();
1620
app.UseSwaggerUI();
1721
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"runtime": "Net80",
3+
"defaultVariables": null,
4+
"documentGenerator": {
5+
"aspNetCoreToOpenApi": {
6+
"project": "ASimpleWeatherApi.csproj",
7+
"msBuildProjectExtensionsPath": null,
8+
"configuration": null,
9+
"runtime": null,
10+
"targetFramework": null,
11+
"noBuild": true,
12+
"msBuildOutputPath": null,
13+
"verbose": true,
14+
"workingDirectory": null,
15+
"requireParametersWithoutDefault": false,
16+
"apiGroupNames": null,
17+
"defaultPropertyNameHandling": "CamelCase",
18+
"defaultReferenceTypeNullHandling": "Null",
19+
"defaultDictionaryValueReferenceTypeNullHandling": "NotNull",
20+
"defaultResponseReferenceTypeNullHandling": "NotNull",
21+
"generateOriginalParameterNames": true,
22+
"defaultEnumHandling": "Integer",
23+
"flattenInheritanceHierarchy": false,
24+
"generateKnownTypes": true,
25+
"generateEnumMappingDescription": false,
26+
"generateXmlObjects": false,
27+
"generateAbstractProperties": false,
28+
"generateAbstractSchemas": true,
29+
"ignoreObsoleteProperties": false,
30+
"allowReferencesWithProperties": false,
31+
"useXmlDocumentation": true,
32+
"resolveExternalXmlDocumentation": true,
33+
"excludedTypeNames": [],
34+
"serviceHost": ".",
35+
"serviceBasePath": null,
36+
"serviceSchemes": [],
37+
"infoTitle": "My Title",
38+
"infoDescription": null,
39+
"infoVersion": "1.0.0",
40+
"documentTemplate": null,
41+
"documentProcessorTypes": [],
42+
"operationProcessorTypes": [],
43+
"typeNameGeneratorType": null,
44+
"schemaNameGeneratorType": null,
45+
"contractResolverType": null,
46+
"serializerSettingsType": null,
47+
"useDocumentProvider": true,
48+
"documentName": "v1",
49+
"aspNetCoreEnvironment": null,
50+
"createWebHostBuilderMethod": null,
51+
"startupType": null,
52+
"allowNullableBodyParameters": true,
53+
"useHttpAttributeNameAsOperationId": false,
54+
"output": null,
55+
"outputType": "Swagger2",
56+
"newLineBehavior": "Auto",
57+
"assemblyPaths": [],
58+
"assemblyConfig": null,
59+
"referencePaths": [],
60+
"useNuGetCache": false
61+
}
62+
},
63+
"codeGenerators": {
64+
"openApiToTypeScriptClient": {
65+
"className": "{controller}Client",
66+
"moduleName": "",
67+
"namespace": "",
68+
"typeScriptVersion": 4.3,
69+
"template": "Angular",
70+
"promiseType": "Promise",
71+
"httpClass": "HttpClient",
72+
"withCredentials": false,
73+
"useSingletonProvider": true,
74+
"injectionTokenType": "InjectionToken",
75+
"rxJsVersion": 7.0,
76+
"dateTimeType": "Date",
77+
"nullValue": "Undefined",
78+
"generateClientClasses": true,
79+
"generateClientInterfaces": false,
80+
"generateOptionalParameters": false,
81+
"exportTypes": true,
82+
"wrapDtoExceptions": false,
83+
"exceptionClass": "ApiException",
84+
"clientBaseClass": null,
85+
"wrapResponses": false,
86+
"wrapResponseMethods": [],
87+
"generateResponseClasses": true,
88+
"responseClass": "SwaggerResponse",
89+
"protectedMethods": [],
90+
"configurationClass": null,
91+
"useTransformOptionsMethod": false,
92+
"useTransformResultMethod": false,
93+
"generateDtoTypes": true,
94+
"operationGenerationMode": "MultipleClientsFromOperationId",
95+
"markOptionalProperties": true,
96+
"generateCloneMethod": true,
97+
"typeStyle": "Interface",
98+
"enumStyle": "Enum",
99+
"useLeafType": false,
100+
"classTypes": [],
101+
"extendedClasses": [],
102+
"extensionCode": null,
103+
"generateDefaultValues": true,
104+
"excludedTypeNames": [],
105+
"excludedParameterNames": [],
106+
"handleReferences": false,
107+
"generateTypeCheckFunctions": false,
108+
"generateConstructorInterface": true,
109+
"convertConstructorInterfaceData": false,
110+
"importRequiredTypes": true,
111+
"useGetBaseUrlMethod": false,
112+
"baseUrlTokenName": "API_BASE_URL",
113+
"queryNullValue": "",
114+
"useAbortSignal": false,
115+
"inlineNamedDictionaries": false,
116+
"inlineNamedAny": false,
117+
"includeHttpContext": false,
118+
"templateDirectory": null,
119+
"serviceHost": null,
120+
"serviceSchemes": null,
121+
"output": "../../sdk-client.ts",
122+
"newLineBehavior": "Auto"
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)