Angular .net core. We are currently migrating from aspnetzero 8.8 to 10.3.
In the RoleAppService there's this method :
public async Task <ListResultDto> GetRoles(GetRolesInput input)
When we query the swagger endpoint, we get this :
"/api/services/app/Role/GetRoles": {
"get": {
"tags": [
"Role"
],
"operationId": "ApiServicesAppRoleGetrolesGet",
"parameters": [
{
"name": "Permissions",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/ListResultDtoOfRoleListDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListResultDtoOfRoleListDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ListResultDtoOfRoleListDto"
}
}
}
}
}
}
},
Why does swagger reduce GetRolesInput
to Permissions
(which is its only Property) ? In the frontend, it triggers compilation errors in the roles.component which doesn't know what a GetRolesInput object is anymore.
I checked in your code and there it's generated just fine. I tried adding other properties to the class, they all seem to be split by swagger. I copied the service.config.nswag from aspnetzero and I also double checked the Startup file in the Web.Host project.
Did I miss a swagger config option somewhere ?
Thanks
4 Answer(s)
-
0
Hi @daws
I could not reproduce it in v10.3. Can you please remove
service-proxies.ts
then run your host project and runnpm run nswag
command in angular project to regenerate clean service-proxies.ts. And check if your problem exists. -
0
I don't think it has anything to do with the service-proxies generation.
As you can see in my request, the swagger endpoint generated in the backend (https://localhost:44301/swagger/v1/swagger.json) already splits the Input class into its properties.
There must be some swagger configuration parameter enabling the split in the backend but I can't seem to find it...
-
0
Hi @daws
Do you see this behavior only for RoleAppService ? If so, could you compare its interface, implementation and input classes with the latest version ? As I can see, it is as expected on our latest version http://volosoft.demo.aspnetzero.com/swagger/v1/swagger.json
-
0
Our mistake. When migrating, we omitted the change which adds the
[HttpPost]
decorator on theGetRoles
method in theRoleAppService
.Without it, it seems that the method is recognized as a GET method and therefore has its input parameters split.
Thanks for the support.