Skip to content

Commit bbf9f5f

Browse files
committed
Update OpenAPI configuration and add new system endpoints
1 parent 612ca8a commit bbf9f5f

2 files changed

Lines changed: 194 additions & 3 deletions

File tree

src/Presentation.Web.Server/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
builder.Services.AddMapping()
4141
.WithMapster<CoreModuleMapperRegister>();
4242

43-
builder.Services.AddEndpoints<SystemEndpoints>(builder.Environment.IsDevelopment());
43+
builder.Services.AddEndpoints<SystemEndpoints>(); // builder.Environment.IsDevelopment()
4444

4545
builder.Services.AddControllers();
4646
builder.Services.AddEndpointsApiExplorer();
4747
builder.Services.AddSwaggerGen();
4848
builder.Services.AddProblemDetails(o => Configure.ProblemDetails(o, true));
49-
builder.Services.AddOpenApi(); // .NET 9 built-in OpenAPI document generation (runtime + build-time support)
49+
builder.Services.AddOpenApi();
5050

5151
// ===============================================================================================
5252
// Configure the HTTP request pipeline
@@ -55,7 +55,7 @@
5555
{
5656
app.UseSwagger();
5757
app.UseSwaggerUI();
58-
app.MapOpenApi(); // Expose /openapi/v1.json in development
58+
app.MapOpenApi();
5959
}
6060

6161
app.UseRequestCorrelation();

src/Presentation.Web.Server/openapi.json

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,128 @@
55
"version": "1.0"
66
},
77
"paths": {
8+
"/api/_system": {
9+
"get": {
10+
"tags": [
11+
"_system"
12+
],
13+
"responses": {
14+
"200": {
15+
"description": "OK",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "object",
20+
"additionalProperties": {
21+
"type": "string"
22+
}
23+
}
24+
}
25+
}
26+
},
27+
"500": {
28+
"description": "Internal Server Error",
29+
"content": {
30+
"application/json": {
31+
"schema": {
32+
"$ref": "#/components/schemas/ProblemDetails"
33+
}
34+
}
35+
}
36+
}
37+
}
38+
}
39+
},
40+
"/api/_system/echo": {
41+
"get": {
42+
"tags": [
43+
"_system"
44+
],
45+
"responses": {
46+
"200": {
47+
"description": "OK",
48+
"content": {
49+
"application/json": {
50+
"schema": {
51+
"type": "string"
52+
}
53+
}
54+
}
55+
},
56+
"500": {
57+
"description": "Internal Server Error",
58+
"content": {
59+
"application/json": {
60+
"schema": {
61+
"$ref": "#/components/schemas/ProblemDetails"
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
68+
},
69+
"/api/_system/info": {
70+
"get": {
71+
"tags": [
72+
"_system"
73+
],
74+
"responses": {
75+
"200": {
76+
"description": "OK",
77+
"content": {
78+
"application/json": {
79+
"schema": {
80+
"$ref": "#/components/schemas/SystemInfo"
81+
}
82+
}
83+
}
84+
},
85+
"500": {
86+
"description": "Internal Server Error",
87+
"content": {
88+
"application/json": {
89+
"schema": {
90+
"$ref": "#/components/schemas/ProblemDetails"
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
97+
},
98+
"/api/_system/modules": {
99+
"get": {
100+
"tags": [
101+
"_system"
102+
],
103+
"responses": {
104+
"200": {
105+
"description": "OK",
106+
"content": {
107+
"application/json": {
108+
"schema": {
109+
"type": "array",
110+
"items": {
111+
"$ref": "#/components/schemas/SystemModule"
112+
}
113+
}
114+
}
115+
}
116+
},
117+
"500": {
118+
"description": "Internal Server Error",
119+
"content": {
120+
"application/json": {
121+
"schema": {
122+
"$ref": "#/components/schemas/ProblemDetails"
123+
}
124+
}
125+
}
126+
}
127+
}
128+
}
129+
},
8130
"/api/core/customers/{id}": {
9131
"get": {
10132
"tags": [
@@ -584,6 +706,75 @@
584706
}
585707
},
586708
"additionalProperties": { }
709+
},
710+
"SystemInfo": {
711+
"type": "object",
712+
"properties": {
713+
"request": {
714+
"type": "object",
715+
"additionalProperties": {
716+
"nullable": true
717+
},
718+
"nullable": true
719+
},
720+
"runtime": {
721+
"type": "object",
722+
"additionalProperties": {
723+
"type": "string",
724+
"nullable": true
725+
},
726+
"nullable": true
727+
},
728+
"memory": {
729+
"type": "object",
730+
"additionalProperties": {
731+
"type": "string",
732+
"nullable": true
733+
},
734+
"nullable": true
735+
},
736+
"configuration": {
737+
"type": "object",
738+
"additionalProperties": {
739+
"type": "string",
740+
"nullable": true
741+
},
742+
"nullable": true
743+
},
744+
"customMetadata": {
745+
"type": "object",
746+
"additionalProperties": {
747+
"type": "string",
748+
"nullable": true
749+
},
750+
"nullable": true
751+
},
752+
"uptime": {
753+
"type": "string",
754+
"nullable": true
755+
}
756+
},
757+
"additionalProperties": false
758+
},
759+
"SystemModule": {
760+
"type": "object",
761+
"properties": {
762+
"name": {
763+
"type": "string",
764+
"nullable": true
765+
},
766+
"enabled": {
767+
"type": "boolean"
768+
},
769+
"isRegistered": {
770+
"type": "boolean"
771+
},
772+
"priority": {
773+
"type": "integer",
774+
"format": "int32"
775+
}
776+
},
777+
"additionalProperties": false
587778
}
588779
}
589780
}

0 commit comments

Comments
 (0)